0
from livewires import games
# load sound file
missile_sound = games.load_sound("missile.wav")
games.music.load('theme.mid')
games.music.play()
missile_sound.play()
   


I try pygame, midi2audio, mido, pyFluidSynth, fluidsynth, i have installed VLC and plugins, and i can listen the midi files in the system, but cannot in python. Program is launching, and nothing happens (no errors). The wav format works, but midi not. I have no idea what can i do. Maybe this post is duplicated, but i cannot found answer for this question. 'theme.mid' i m convert this file in wav, and its work. but i want work with midi files. Thank you.

HATRED
  • 3
  • 2
  • This is not a minimal reproducible example. Which input case causes the issue? Edit your post and remove all the code that isn't required to duplicate the issue. – blackbrandt Feb 27 '23 at 19:19
  • @blackbrandt I tried almost everything that was written here, none of the methods helped. I will delete this code. There are no errors, when the program starts, the "wav" file is played, but the "midi" file is not. The file itself is not damaged, I checked. I did absolutely everything through all the libraries I found. – HATRED Feb 27 '23 at 19:41
  • Give [this page](https://stackoverflow.com/help/minimal-reproducible-example) a read. For example, `if choice == '0': print("Goodbye")` does not affect the example, right? So it shouldn't be in your Minimal Reproducible Example. Check to confirm but I'm pretty certain you can take out the entire while loop and just keep your import/setup statements along with `missile_sound.play(loop)`. – blackbrandt Feb 27 '23 at 20:06

1 Answers1

0

Midi is not an audio file that you can play. Midi is simply data. Midi says "Play the sound file associated with the note C4" if there is no sound file loaded at C4 the computer plays no sound. Run your midi file through a virtual instrument in garage band. Bounce that out (export the song) to a .WAV file and use that. theme.mid in your code has no sound/audio data associated with it. It only has the data on what notes should be played. You're basically handing sheet music to a brick wall.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 11 '23 at 09:28