#40 Support for audio input and output files

open
nobody
None
5
2014-08-19
2011-04-16
No

One of very nice fatures in the LTSpice (whichj unfortunately is not open source) is the possibility to read signals from audio files and to write signals to audio files ( http://electrostud.wikia.com/wiki/Using_WAVE_files_as_input/output_in_LTSpice ).
I think, that similar feature could be also very useful in QUCS (e.g. sometimes I use it to demonstrate operation of audio processing circuits for my students).

I've prepared some data converter for QUCS:
QUCS-> Python http://groups.google.com/group/alt.sources/browse_thread/thread/e2f3007b60c02af7
QUCS->Octave -> http://groups.google.com/group/alt.sources/browse_thread/thread/256dd5ee7e365db0
Octave->Qucs -> http://groups.google.com/group/alt.sources/browse_thread/thread/7775fc3c9cb4ad3b

However even though the above converters allow to convert audio file into QUCS data and then to convert results back to audio
format, it is very inconvenient to do it with external programs...

It would be very good to have possibility to have e.g. voltage source for transient analysis with values read as samples from WAV or FLAC file (of course with possibility to interpolate values between the sampling moments).
Similarly it should be possible to store results of simulation into the WAV or FLAC file with defined resolution and sampling frequency.

Discussion

  • Cousteau

    Cousteau - 2013-06-27

    This shouldn't be too hard to do for someone who knows Yacc and how the WAV and FLAC formats are (the WAV format is pretty simple; I don't know about FLAC).

    If you have a look at qucs-core/src/components/vfile.cpp (and ifile.cpp), you can see these lines:

    if (strlen (file) > 4 && !strcasecmp (&file[strlen (file) - 4], ".dat"))
      data = dataset::load (file);
    else
      data = dataset::load_csv (file);
    

    so it would be a matter of adding something like

    else if (strlen(file) > 4 && !strcasecmp(&file[strlen(file) - 4], ".wav"))
      data = dataset::load_wav(file);
    else if (strlen(file) > 5 && !strcasecmp(&file[strlen(file) - 5], ".flac"))
      data = dataset::load_flac(file);
    

    and then modifying qucs-core/src/dataset.cpp to add dataset::load_wav() and dataset::load_flac() methods.

    Right now all file parsers use Yacc, which I have no idea how to use, nor what files should be created and modified (parse_wav.y and parse_flac.y, and don't know if some makefiles or scripts). Another solution would be to ignore the Yacc part and write a function that directly does all the parsing work, but this might not be a good idea since it's not how the rest of Qucs seems to be.

     
    Last edit: Cousteau 2013-06-27
  • Frans

    Frans - 2013-07-02

    I think it is easy to implement this using an octave script.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks