wx.Sound : wav file unsupported - audio

I'm doing a game with wx.python and when I try to add a background music using wx.Sound I got the following error:
Python error:
Sound file 'images/game.wav' is in unsupported format.
This is the code I use. I've seen this code many times on the web but none had
the same problem:
sound = wx.Sound("images/game.wav")
sound.Play(wx.SOUND_ASYNC)

Sounds like you need to save the WAV file in a different format. WAV files are not all created equal.
http://en.wikipedia.org/wiki/WAV#WAV_file_compression_codecs_compared

Why not use wx.media or maybe the mplayer widget? I have a tutorial on each of these:
http://www.blog.pythonlibrary.org/2010/07/24/wxpython-creating-a-simple-media-player/
http://www.blog.pythonlibrary.org/2010/04/20/wxpython-creating-a-simple-mp3-player/

Related

Convert ABC notation file to MIDI, and then render MIDI as audio

I have this data which I have found on the net, I am not even sure what this data is, but I'm sure it is some kind of music notes. Can you help me convert it into an audio file?
E|"D"F3 "A7/c+"A2G|"Bm"FGF "A7"E3|"D"F2A d2c|"G"BcB "D"A3|"G"G2B "A7"A2G|\
"D"F2A d2f|
"G"efe "E7"dcB|"A7"ABA GFE|"D"F3 "A7/c+"A2G|"Bm"FGF "A7"E3|"D"F2A d2c|
"G"BcB "D"A3|"G"G2B "A7"A2G|"D"F2E "Bm"D2F|"Em"EFG "A7"F2E|"D"D3 -D2||
A|"D"d3 fed|"A"c2d e2A|"Bm"Bcd c2B|"F#m"A3 A2A|"G"B3 dcB|
"D"A2d f2a|"G"agf "E7"fed|"A7"e3 e2A|"D"d3 fed|"A"c2B A2A|
"Bm"B3 dcB|"F#m"A3 A2F|"G"G3 BAG|"D"F2A d2D|"Em"EFG "A7"F2E|"D"D3 -D2||
EDIT 1:
I have come to know that this is an '.abc' type of file, also online converters are available to convert it into an audio file.
But I really need to write a python code to convert abc files to midi and midi files to abc files.

Media Info says wav file is truncated instead of showing the properties

I have written some data to a wav file along with the header. But when i play it using media player or VLC it does not play. When I open the same file using MediaInfo, it says 'IsTruncated: Yes' . what does this truncated mean and how to solve this.
Please help

HandbrakeCLI command lines

I'm trying to convert DVD iso files to mp4 using HandbrakeCLI. I use the following line in a batch file:
D:\HandBrakeCLI.exe -i "D:\input.iso" -o "D:\output.mp4" --no-markers --width "720" --height "480" --preset "HQ 480p30 Surround" --encoder "mpeg2" --audio-lang-list "eng"
When I do this, I must then extract the audio from the file, using the following line:
D:\eac3to\eac3to.exe "D:\output.mp4" "D:\output.wavs" -down16
However, when I attempt to extract the audio, I get the error message
The format of the source file could not be detected.
Is there anything wrong with my former line of code that's causing the mp4 to get screwed up?
Minor side question: I'm also trying to get handbrake to remove subtitles and also only keep English audio, do you know what code could be used for that? I started a bit there with the --audio-lang-list "eng" but I'm now sure what to do from there.
Thanks a lot in advance!
You need to use a valid audio format. .wavs is not valid. You have to use an available audio codec to output to the below for --aencoder. The default output audio for MP4 is .aac
av_aac
copy:aac
ac3
copy:ac3
eac3
copy:eac3
copy:truehd
copy:dts
copy:dtshd
mp3
copy:mp3
vorbis
flac16
flac24
copy:flac
opus
copy
Defaults for audio
av_mp4 = av_aac
av_mkv = mp3
You need to pass none for no subtitles
-s none
And define only eng track like you were doing
--audio-lang-list eng
Check out the Handbrake CLI Documentation for the command line code:
https://handbrake.fr/docs/en/latest/cli/cli-guide.html
You can also try using a different program once you extract the audio. A program like XMediaRecode. It can also remux audio and video and convert other audio formats to wav
https://www.videohelp.com/software/XMedia-Recode

iOS - Convert Audio Format (opus to mp3)

Recently I started to develop application that work with .opus file (Audio Format).
I am working with external SDK that can processor a mp3/wav file, unfortunately my local file is a .opus file and I need to convert it to mp3/wav format in order to process the file.
I read and research a lot around the network to find a solution,
I found the FFmpegWrapper library that can convert two type of Audio Format but when I try to convert .opus to .mp3/ , I get this error: opus codec not supported in WAVE format
I do not know what can be done, I'll be happy to help.
Any information about how to convert .Opus format to any other format will be appreciated.
Thanks
Have you tried using this pod: https://github.com/chrisballinger/Opus-iOS
You can use it to convert your Opus-encoded file to wav, then feed it into your SDK.

About Tkinter python 2.76 on Linux Mint 17.2

I have 2 functions as below:
def select_audio():
os.chdir("/home/norman/songbook")
top1.lower(root)
name=tkFileDialog.askopenfilename()
doit="play " + name
top1.lift(root)
os.system(doit)
def select_video():
os.chdir("/home/norman/Videos")
top2.lower(root)
name=tkFileDialog.askopenfilename()
doit="mpv --fs " + name
top2.lift(root)
os.system(doit)
They are selected from buttons to allow choosing and playing audio files or video files.
They work to some extent.
Videos are in a different directory and at the same level as the audio files.
It doesn't matter which I choose first I see the correct directory so I can play say a video, if after it's finished I choose audio it still shows the video directory.
Similarly if I first choose audio it still shows the audio directory if I select videos.
I have no idea why it does this. I am not an experienced programmer as you can probably tell from the code.
Some suggestions:
Use a raw string to make sure that Python doesn't try to interpret anything following a \ as an escape sequence:
Change os.chdir("/home/norman/whatever") to os.chdir(r"/home/norman/whatever")
It won't solve this problem, but it will avoid you future problems.
For tkFileDialog use the initialdir option:
Change name=tkFileDialog.askopenfilename() to
name=tkFileDialog.askopenfilename(initialdir=r"home/norman/whatever", parent=root)

Resources