Audio conversion how


#1

Could someone quickly just skecth how you would use JUCE methods to read from one format and write other format (audio files: wav ogg flac) i mean in sequence what has to be done, i got lost in thoe Reader and Writer classes and am not sure how to deal with this, maybe someone can point me to some source code example, that would be fine too.


#2

Sketchty: In a loop, read N samples from one format (f.i. ogg AudioFormatReader) into a AudioSampleBuffer via AudioSampleBuffer::readFromAudioReader, then write N samples into the other format (f.i. wav AudioFormatWriter) via AudioSampleBuffer::writeToAudioWriter, until you’re done. Simple as that (thnx jules).


#3

i spent last two days getting to that :slight_smile:

thanks jules for making it simple, it’s just my head that’s not working properly.

could someone also explaing to me what is the quality setting for FLAC, i thought it’s a losseless codec so what is the quality setting for ?


#4

If the setting is labelled quality, I think that’s a misnomer.

Flac is lossless, but you can adjust the level of compression. Depending on your music style, upping this setting will often just cause the encoder to spend a very long time making your audio file very fractionally smaller. Typically the default setting is good balance of time/CPU load over resultant file size.


#5

the “quality” word caught my attention

qualityOptionIndex 	the index of one of compression qualities returned by the getQualityOptions() method. If there aren't any quality options for this format, just pass 0 in this parameter, as it'll be ignored 

this is the documentation for the createWriterFor() method of the FlacAudioFormat class.