AudioWaveform
Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller
AudioWaveform
Dear all
I want to access sample values of a audio file (uncompressed: wav)
I got a rev-code for that from a friend: AudioWaveform.rev
But I can not load a wav file in that .rev stack using LiveCode 9
Does anyone know a newer version of AudioWaveform ?
Or a more general question: I found -> customProperties["FileInfo"]
which allows me to read the file header.
Does anyone know how to access the same-values of a wav-file in order to display an oscillogram?
Best
Bernd
I want to access sample values of a audio file (uncompressed: wav)
I got a rev-code for that from a friend: AudioWaveform.rev
But I can not load a wav file in that .rev stack using LiveCode 9
Does anyone know a newer version of AudioWaveform ?
Or a more general question: I found -> customProperties["FileInfo"]
which allows me to read the file header.
Does anyone know how to access the same-values of a wav-file in order to display an oscillogram?
Best
Bernd
Re: AudioWaveform
There are *mighty* cross-platform tools available that can (also) create waveforms.
1. CLIs, you can use them from LiveCode via shell():
audiowaveform
https://github.com/bbc/audiowaveform
(can also create the data as json file if you wish to make your own)
ffmpeg
https://www.ffmpeg.org , especially
https://trac.ffmpeg.org/wiki/Waveform
Makes not a waveform but a spectrogram:
SOX
http://sox.sourceforge.net
2. Or, very comfortable, but you have to wait until the browser widget supports Web Audio:
wavesurfer.js
https://wavesurfer-js.org
1. CLIs, you can use them from LiveCode via shell():
audiowaveform
https://github.com/bbc/audiowaveform
(can also create the data as json file if you wish to make your own)
ffmpeg
https://www.ffmpeg.org , especially
https://trac.ffmpeg.org/wiki/Waveform
Makes not a waveform but a spectrogram:
SOX
http://sox.sourceforge.net
2. Or, very comfortable, but you have to wait until the browser widget supports Web Audio:
wavesurfer.js
https://wavesurfer-js.org
shiftLock happens
Re: AudioWaveform
thanks a lot!
so, I know that liveCode does not supports only play audio directly.
so, If I want to display an oszillogram and a spectrogram in Livecode at least for short audios it is the best way to calculate these osz-data and spec-data outside livecode, import these data and display them in my LiveCode app.??
Best
Bernd
so, I know that liveCode does not supports only play audio directly.
so, If I want to display an oszillogram and a spectrogram in Livecode at least for short audios it is the best way to calculate these osz-data and spec-data outside livecode, import these data and display them in my LiveCode app.??
Best
Bernd
Re: AudioWaveform
Yes. LiveCode would be much slower than these compiled CLIs which handle, BTW, nearly all audio formats.
For example SoX needs three seconds for a spectrogram of 9 MByte mp3:
1. Make a new stack of size 660x400 and create an image
2. Make a folder containing a sound file test.mp3
[You can then also play the sound with SoX via open process ...]
The rest of the GUI (incl. controls) is best done with LiveCode.
For example SoX needs three seconds for a spectrogram of 9 MByte mp3:
1. Make a new stack of size 660x400 and create an image
2. Make a folder containing a sound file test.mp3
Code: Select all
On MouseUp
put </path/to/folder> into f
put "test.mp3" into mp3
-- there are a lot of other options, see man page of sox:
get shell ("cd f; sox " & mp3 & " -n spectrogram -Y 360 -x 480")
set filename of img 1 to empty -- needed for a refresh
set filename of img 1 to f&"/spectrogram.png"
end MouseUp
The rest of the GUI (incl. controls) is best done with LiveCode.
shiftLock happens
Re: AudioWaveform
great!
that helps me a lot!
thanks!
Bernd
that helps me a lot!
thanks!
Bernd
Re: AudioWaveform
[-hh], thanks for the useful tip, I have looked for something like this for a while... I nevertheless cannot get your example working. I manage to create a spectrogram from within Terminal, but not from the Livecode Stack. I am working on MacOs X 10.12.6 with LC 9.5.
In Terminal I wrote: "/Users/oliver/Documents/development/waveform/sox /Users/oliver/Documents/development/waveform/test.aif -n spectrogram -Y 360 -x 480" and it works, but from within livecode it doesnt. Any tip?
I managed to get a simple file transformation to work from the LC stack:
Thanks
Oliver
In Terminal I wrote: "/Users/oliver/Documents/development/waveform/sox /Users/oliver/Documents/development/waveform/test.aif -n spectrogram -Y 360 -x 480" and it works, but from within livecode it doesnt. Any tip?
I managed to get a simple file transformation to work from the LC stack:
Code: Select all
get shell ("/Users/oliver/Documents/development/waveform/sox /Users/oliver/Documents/development/waveform/test.aif /Users/oliver/Documents/development/waveform/testnew.wav")
Thanks
Oliver
Last edited by okk on Wed Feb 26, 2020 10:34 am, edited 2 times in total.
Re: AudioWaveform
And a second question: I got the waveform generator that you mentioned in your post working on my computer. But how would this work in a standalone? I dont want that my users need to install audiowaveform and the required libraries. It wasn't the most smooth installtion anyway. Is it possible to copy all the needed files when creating the standalone? Thanks for any hint.
Oliver
Oliver
Re: AudioWaveform
Hi,
I just released an FREE Waveform Widget that may interest you. It has been tested in Livecode Create 1.0 (DP12) Classic Mode.

"Waveform" is an advanced audio waveform widget with mono/stereo support and DAW-like pan/zoom features. Supports MP3, WAV and FLAC audio files in stereo or mono. Developed for macOS (Intel, Apple Silicon and Universal) and Windows (X86-64).
Use the waveform widget to show stereo or mono audio waveform data with full RGBA color picker support, interactive marquee or scroll-wheel zooming, mouse or scroll-wheel panning, adaptive time/amplitude grids and data marker. Format the timeline in "samples", "seconds" or "SMPTE" and the amplitude in "%" or "dB" (decibel). Show separate channels or overlay channels on top of each other. Use widget messages to synchronize multiple waveform widgets or set play position in an player object.
Simply to view the waveform of an MP3, WAV or FLAC audio file.
If you find bugs or have suggestion for features, please contact mailto:contact@Appic.se
Developed by Appic (https://appic.se/).
Powered by dr_libs (https://github.com/mackron/dr_libs).
Download the Widget at https://appic.se/livecode/waveform_widget_1.0.0.zip Please read the ReadMe.txt file in the zip-file.
Visit https://appic.se/livecode/livecode.html where we soon will release the MixPlay widget - an 64 channel audio player.
Best Regards,
Peter
I just released an FREE Waveform Widget that may interest you. It has been tested in Livecode Create 1.0 (DP12) Classic Mode.

"Waveform" is an advanced audio waveform widget with mono/stereo support and DAW-like pan/zoom features. Supports MP3, WAV and FLAC audio files in stereo or mono. Developed for macOS (Intel, Apple Silicon and Universal) and Windows (X86-64).
Use the waveform widget to show stereo or mono audio waveform data with full RGBA color picker support, interactive marquee or scroll-wheel zooming, mouse or scroll-wheel panning, adaptive time/amplitude grids and data marker. Format the timeline in "samples", "seconds" or "SMPTE" and the amplitude in "%" or "dB" (decibel). Show separate channels or overlay channels on top of each other. Use widget messages to synchronize multiple waveform widgets or set play position in an player object.
Simply
Code: Select all
set the audioPath of widget <myWidget> to <audioPath>If you find bugs or have suggestion for features, please contact mailto:contact@Appic.se
Developed by Appic (https://appic.se/).
Powered by dr_libs (https://github.com/mackron/dr_libs).
Download the Widget at https://appic.se/livecode/waveform_widget_1.0.0.zip Please read the ReadMe.txt file in the zip-file.
Visit https://appic.se/livecode/livecode.html where we soon will release the MixPlay widget - an 64 channel audio player.
Best Regards,
Peter
Re: AudioWaveform
Hi Peter,
That sounds very interesting.
However I did not get the widget installed.
Could you please indicate how and where to install the widget.
And how to use the widget
Thank you
Bernd
That sounds very interesting.
However I did not get the widget installed.
Could you please indicate how and where to install the widget.
And how to use the widget
Thank you
Bernd
Re: AudioWaveform
Hi Bernd,
just download and unZIP the widget.
Then use the "Extension Manager" to locate and open the "community.livecode.appic.waveform.1.0.0.lce" file.
I installed it for LC 10.0.6 rc1, but should be the same for LC 11 and/or CREATE.
Best
Klaus
just download and unZIP the widget.
Then use the "Extension Manager" to locate and open the "community.livecode.appic.waveform.1.0.0.lce" file.
I installed it for LC 10.0.6 rc1, but should be the same for LC 11 and/or CREATE.
Best
Klaus
Re: AudioWaveform
Hi Klaus,
Thank you, that worked perfectly.
I opened a larger WAV file in the widget and it opened it instantly and it showed the waveform.
It was also installed in the dictionary and I was able to see the API.
Thank you Peter. That seems like a very fine and extremely fast widget.
Kind regards
Bernd
Thank you, that worked perfectly.
I opened a larger WAV file in the widget and it opened it instantly and it showed the waveform.
It was also installed in the dictionary and I was able to see the API.
Thank you Peter. That seems like a very fine and extremely fast widget.
Kind regards
Bernd
-
richmond62
- Livecode Opensource Backer

- Posts: 10486
- Joined: Fri Feb 19, 2010 10:17 am
Re: AudioWaveform
As this is free, presumably it is legal to use it with OXT Lite, OXT DPE, OXTL7, or HyperXtalk.
