Closed letarg0 closed 6 years ago
To reverse a *.wav file, you can read the entire file into a buffer, reverse the buffer's sample array, and then write it back out. For example:
require 'wavefile'
include WaveFile
reader = Reader.new("to_be_reversed.wav")
buffer = reader.read(reader.total_sample_frames)
reader.close
buffer.samples.reverse!
writer = Writer.new("reversed.wav", reader.format) do |writer|
writer.write(buffer)
end
(There's currently not a good way to reverse a file without reading the entire file into memory).
This article describes how to create some simple sounds and write them to a *.wav file, including white noise: https://www.joelstrait.com/nanosynth_create_sound_with_ruby/
Hope this helps!
Closing this issue, hope this helped!
i have wav and need reverse file how read file and add noise or add other file wav?