Pygame error unknown wave data format

So i was making an Audio Player, it downloads audio using YT-DLP and then plays it using pygame.mixer. the main problem, i am getting is that pygame Won't Run that Audio instead it would Just g...

@iamDyeus

So i was making an Audio Player, it downloads audio using YT-DLP and then plays it using pygame.mixer.
the main problem, i am getting is that pygame Won’t Run that Audio instead it would Just give Errors for Different Audio Formats like Wav, Ogg, and Mp3.

For Wav Format I get this Error : pygame.error: Unknown WAVE format
For MP3 I get this Error : pygame.error: mpg123_seek: Invalid RVA mode. (code 12)
For Ogg I get this Error : pygame.error: Not an Ogg Vorbis audio stream

After Wondering with these things For a While, I think there is Something Wrong with the Codecs.
Attaching images of 2 Audio Files below (One which is playable with pygame, And one which Gives Errors with it)

working_file_Codec_img

Nonworking_file_Codec_img

@Starbuck5

I’ve seen you talking about this on discord, on stackoverflow, and now here 😄

It’s because it’s in a video file, right?

You can use youtube-DL to download just the audio, I’m pretty sure.

@iamDyeus

Here is the Code which was used to download the Audio File

from  yt_dlp import YoutubeDL
(option,C1,C2,C3)=[dict(extractaudio=True,outtmpl='src/backend/temp_audio/%(title)s.mp3'),'https://youtu.be','https://youtube.com','https://www.youtube.com',]

def download_song(link):
        try:
            with YoutubeDL(option) as ydl:
                ydl.download([link])
        except:
            print("Error in Downloading : " + link )
            pass
            

Command to install the prerequisite : python -m pip install yt-dlp
Also for a quick Review, here is the link to the test Audio File i wanted to play .

@iamDyeus

Problem Solved

After Asking Tons of people on Discord Servers of Pygame and yt-dlp.

what i found?

  • pygame won’t be able to play an Audio file with that Specs.
  • So we can use yt-dlp with ffmpeg to modify the Audio for making it compatible with pygame.

So How can we install ffmpeg :

  1. Download ffmpeg : (https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip)

  2. Extract the files and find ffmpeg.exe and ffprobe.exe inside the bin folder.

  3. Copy those two files to the same folder as your Script.

Now

After installing ffmpeg, there needs to be made some changes in our yt-dlp’s code in order to make it run with ffmpeg. Below is the New Code :

from  yt_dlp import YoutubeDL

option={'final_ext': 'mp3',
 'format': 'bestaudio/best',
 'postprocessors': [{'key': 'FFmpegExtractAudio',
                     'nopostoverwrites': False,
                     'preferredcodec': 'mp3',
                     'preferredquality': '5'}],
 'outtmpl': 'src/backend/temp_audio/%(title)s.%(ext)s',
 'ffmpeg_location': 'YOUR-LOCATION/ffmpeg.exe'}

def download_song(link):
        try:
            with YoutubeDL(option) as ydl:
                ydl.download([link])
        except:
            print(Exception)
            pass

Now the Audio Files would Work Perfectly With pygame!

Содержание

  1. pygame.error: Unknown WAVE format about soundboard HOT 1 CLOSED
  2. Comments (1)
  3. Related Issues (1)
  4. Recommend Projects
  5. React
  6. Vue.js
  7. Typescript
  8. TensorFlow
  9. Django
  10. Laravel
  11. Recommend Topics
  12. javascript
  13. server
  14. Machine learning
  15. Visualization
  16. Recommend Org
  17. Facebook
  18. Microsoft
  19. pygame.error: Unknown WAVE format about soundboard HOT 1 CLOSED
  20. Comments (1)
  21. Related Issues (1)
  22. Recommend Projects
  23. React
  24. Vue.js
  25. Typescript
  26. TensorFlow
  27. Django
  28. Laravel
  29. Recommend Topics
  30. javascript
  31. server
  32. Machine learning
  33. Visualization
  34. Recommend Org
  35. Facebook
  36. Microsoft
  37. pygame.error: Unknown WAVE format about soundboard HOT 1 CLOSED
  38. Comments (1)
  39. Related Issues (1)
  40. Recommend Projects
  41. React
  42. Vue.js
  43. Typescript
  44. TensorFlow
  45. Django
  46. Laravel
  47. Recommend Topics
  48. javascript
  49. server
  50. Machine learning
  51. Visualization
  52. Recommend Org
  53. Facebook
  54. Microsoft
  55. Reading wav file in macos causes error: «unknown format» #53
  56. Comments

pygame.error: Unknown WAVE format about soundboard HOT 1 CLOSED

It was an issue of your file 1/test.wav

Recommend Projects

React

A declarative, efficient, and flexible JavaScript library for building user interfaces.

Vue.js

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

Typescript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

TensorFlow

An Open Source Machine Learning Framework for Everyone

Django

The Web framework for perfectionists with deadlines.

Laravel

A PHP framework for web artisans

Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

javascript

JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

Some thing interesting about web. New door for the world.

server

A server is a program made to process requests and deliver data to clients.

Machine learning

Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

Visualization

Some thing interesting about visualization, use data art

Some thing interesting about game, make everyone happy.

Recommend Org

Facebook

We are working to build community through open source technology. NB: members must have two-factor auth.

Microsoft

Open source projects and samples from Microsoft.

Источник

pygame.error: Unknown WAVE format about soundboard HOT 1 CLOSED

It was an issue of your file 1/test.wav

Recommend Projects

React

A declarative, efficient, and flexible JavaScript library for building user interfaces.

Vue.js

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

Typescript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

TensorFlow

An Open Source Machine Learning Framework for Everyone

Django

The Web framework for perfectionists with deadlines.

Laravel

A PHP framework for web artisans

Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

javascript

JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

Some thing interesting about web. New door for the world.

server

A server is a program made to process requests and deliver data to clients.

Machine learning

Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

Visualization

Some thing interesting about visualization, use data art

Some thing interesting about game, make everyone happy.

Recommend Org

Facebook

We are working to build community through open source technology. NB: members must have two-factor auth.

Microsoft

Open source projects and samples from Microsoft.

Источник

pygame.error: Unknown WAVE format about soundboard HOT 1 CLOSED

It was an issue of your file 1/test.wav

Recommend Projects

React

A declarative, efficient, and flexible JavaScript library for building user interfaces.

Vue.js

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

Typescript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

TensorFlow

An Open Source Machine Learning Framework for Everyone

Django

The Web framework for perfectionists with deadlines.

Laravel

A PHP framework for web artisans

Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

javascript

JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

Some thing interesting about web. New door for the world.

server

A server is a program made to process requests and deliver data to clients.

Machine learning

Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

Visualization

Some thing interesting about visualization, use data art

Some thing interesting about game, make everyone happy.

Recommend Org

Facebook

We are working to build community through open source technology. NB: members must have two-factor auth.

Microsoft

Open source projects and samples from Microsoft.

Источник

Reading wav file in macos causes error: «unknown format» #53

I’m running from source in Python 3.6.8 on MacOS. When I load a wav file using the toolbar, the UI never changes and the file never loads. Here are the logs near the end:

Here are the attributes from the wave file using mediainfo:

The text was updated successfully, but these errors were encountered:

Okay, looks like papagayo only wants mono wave files. I converted the file from stereo to mono and it loaded.

However, I’m getting the following error when I hit the play button:

I suspect it also doesn’t like 32bit audio. Can you please try to convert into 16bit WAV?

Yes, will try tonight. Thanks.

Thanks for the help :-). Okay tried again with a 16 bit file and am getting the same error. FYI: the same audio file plays back fine running the 1.4.x branch under python2. But running the master branch against python3 causes the error to occur on file playback.

I’m using the audio file here:

When hitting play I get this error:

Finally, here is the console output for the entire run:

@taji I have examined the file you provided and it played fine for me (my system is Linux). Can you please try if this file work for you? — https://github.com/LostMoho/Papagayo/raw/master/installer/Papagayo/Tutorial%20Files/lame.wav

Same for me. I’m on linux 18.04lts. It works when I export in mono 16bit

Tested against the lame.wav file and encountered the same error.

I’m new to this code and to sounddevice, but looking at the code in question:

It looks like audioop.mul returns data, a sound fragment (which from the documentation is an array of bytes?), so when we call data.get_array_of_samples, it’s failing. I would expect this because the fragment isn’t a proper class but rather a built in python type. So there is no get_array_of_samples method attached to the data object.

Earlier in the same file, there is another call to get_array_of_samples that is being called against an AudioSegment object (here’s the docs on the get_array_of_samples call: https://github.com/jiaaro/pydub/blob/master/API.markdown#audiosegmentget_array_of_samples). Is it possible the data object needs to be converted to an AudioSegment?

You are right. Line 138 needs to be changed to «self.audio.play(list(data), blocking=False)»
I can’t play audio at the moment, so that is untested, but the data looks correct.
But the while loop after that also needs to be changed.
Currently the play cursor will not move there.

Optimally we want to change this anyway to use QTs audio output options, but having a fix for that would be nice.

@steveway thanks for the response. I made the change to line 138 as follows:

Here is the output from the log:

For the play function, the docs indicate that the first parameter is data : array_like and the allowable values in the array are: The data types float64, float32, int32, int16, int8
and uint8 can be used.

Reading here: https://stackoverflow.com/a/48132998/1354111 confirms that the mul function returns a bytes object, but I can’t figure out why mul returns the bytes as int64 samples.

Strange, I tried this with both the file you linked and with the lame.wav.
I don’t get the same error as you get, are you testing this with a different file maybe?
Can you tell me a bit about the environment you are testing this on?

Here are my system stats. Let me know if you need anything else. 🙂

System Version: macOS 10.14.1 (18B75)
Kernel Version: Darwin 18.2.0

brew list —versions
autoconf 2.69
cairo 1.14.10
fontconfig 2.12.6
freetype 2.8.1
fribidi 0.19.7_1
gdbm 1.18.1
gettext 0.19.8.1
glib 2.54.1
gobject-introspection 1.54.1
graphite2 1.3.10
icu4c 59.1
jpeg 9c
leptonica 1.74.4_1
libffi 3.2.1
libidn2 2.1.0
libpng 1.6.36
libtiff 4.0.10
libunistring 0.9.10
openssl 1.0.2q
pcre 8.41
pixman 0.34.0_1
pkg-config 0.29.2
portaudio 19.6.0
python 3.7.2_1
python@2 2.7.15_2
readline 8.0.0
sqlite 3.26.0_1
tesseract 3.05.01
wget 1.20.1_3
wxmac 3.0.4_1
xz 5.2.4 5.2.3
zimg 2.6.1
zlib 1.2.11

pip3 list —version
Package Version

cffi 1.11.5
numpy 1.16.1
pip 18.1
pycparser 2.19
PySide2 5.12.1
setuptools 40.6.3
shiboken2 5.12.1
sounddevice 0.3.12
wheel 0.32.3

Any thoughts on this? Maybe there is a portaudio test app that I can use to see what sample format it is providing?

One more thing, using the wave files mentioned above, the 1.4.x loads and plays the wave files (running in Python 2 of course). But the master branch is still not working.

@steveway : I pulled down your fork with the QT audio file load and playback. I tested the lame and difficult wav files mentioned above. Your fork can load and playback the audio in MacOS without error (I also tested against a 32 bit floating point wav file and it worked fine as well). I’m assuming this is going to get pushed to the parent project at some point? if so we can close this issue.

One more thing: after loading, the wave form isn’t painting in the UI with your fork, but I’m thinking that’s a known issue?:

Yup, that uses QT functions to load and playback audio.
If I find a way to get the audio data itself from that to create the waveform then we can replace our current Soundplayer.py with that.
See also this for updates: #54

It has quick-and-dirty solution to draw waveform and should also play WAV files.

Pulled down the qmediaplayer code and retested. The new code draws the wave form. :-). Also, (may not be ready/relevant):

  • You can only play the audio file once. The timeline marker moves to the end of the file and then you can’t move it again. After the first playback, if you click on the play button nothing happens. If you click on the waveform, no animation and no sound.

My version should now fix the play button state.

@steveway : Sorry I’m away from this so long. I pulled down the latest from your fork (both the master and qmediaplayer branches) and now I am unable to load the audio file again. Did something change? Which version would be appropriate to test now? In the future, I’ll try to be more consistent about testing.

Strange, try my master branch here:
https://github.com/steveway/papagayo-ng
I can load and play the difficult.wav file that you linked here, the waveform itself also looks correct currently.
I’ve tested this here with Windows 10 (64bit) and PySide2 version 5.12.0 and also 5.12.1
There are some bugs with creating the waveform visualization in some cases, that needs to best be solved in PySide2 itself, apparently this is now being worked on after I created an issue there:
https://bugreports.qt.io/browse/PYSIDE-934?focusedCommentId=448389&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-448389

Okay, good to know. I’ll pull down that version and do some testing this evening.

@steveway : Okay, pulled down the latest from your fork on master branch. Running PySide2 version 5.12.1 . (Same machine as last time, so the packages listed above are the same).

Steps to reproduce:
Run python3 papayago-ng.py
File | Open (select the lame.wav file).
Expected: File loads and waveform is drawn and rest of GUI is filled in.
Actual: No change to GUI at all. Waveform is blank.

Here is the log:
mb076988aus:papagayo-ng taji$ python3 papagayo-ng.py
Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute before constructing QGuiApplication.
/Users/taji/papagayo-steveway-master/papagayo-ng/rsrc/mouths/6 — Azia Comics 1 (preston_blair) [‘L.jpg’, ‘O.jpg’, ‘FV.jpg’, ‘etc.jpg’, ‘MBP.jpg’, ‘U.jpg’, ‘rest.jpg’, ‘AI.jpg’, ‘E.jpg’, ‘WQ.jpg’]
/Users/taji/papagayo-steveway-master/papagayo-ng/rsrc/mouths/7 — Azia Comics 2 (preston_blair) [‘L.jpg’, ‘O.jpg’, ‘FV.jpg’, ‘etc.jpg’, ‘MBP.jpg’, ‘U.jpg’, ‘rest.jpg’, ‘AI.jpg’, ‘E.jpg’, ‘WQ.jpg’]
/Users/taji/papagayo-steveway-master/papagayo-ng/rsrc/mouths/5 — Fleming and Dobbs [‘AA.jpg’, ‘EHSZ.jpg’, ‘O.jpg’, ‘FV.jpg’, ‘IY.jpg’, ‘SH.jpg’, ‘GK.jpg’, ‘MBP.jpg’, ‘rest.jpg’, ‘NLTDR.jpg’, ‘TH.jpg’, ‘source.sif’]
/Users/taji/papagayo-steveway-master/papagayo-ng/rsrc/mouths/3 — Gary C Martin [‘L.jpg’, ‘O.jpg’, ‘FV.jpg’, ‘etc.jpg’, ‘MBP.jpg’, ‘U.jpg’, ‘rest.jpg’, ‘AI.jpg’, ‘E.jpg’, ‘WQ.jpg’]
/Users/taji/papagayo-steveway-master/papagayo-ng/rsrc/mouths/1 — Mouth 1 [‘L.png’, ‘O.png’, ‘FV.png’, ‘etc.png’, ‘MBP.png’, ‘U.png’, ‘rest.png’, ‘AI.png’, ‘E.png’, ‘WQ.png’]
/Users/taji/papagayo-steveway-master/papagayo-ng/rsrc/mouths/8 — Rhubarb [‘H.png’, ‘B.png’, ‘C.png’, ‘rest.png’, ‘A.png’, ‘D.png’, ‘E.png’, ‘G.png’, ‘F.png’]
/Users/taji/papagayo-steveway-master/papagayo-ng/rsrc/mouths/2 — Mouth 2 [‘L.jpg’, ‘O.jpg’, ‘FV.jpg’, ‘etc.jpg’, ‘MBP.jpg’, ‘U.jpg’, ‘rest.jpg’, ‘AI.jpg’, ‘E.jpg’, ‘WQ.jpg’]
/Users/taji/papagayo-steveway-master/papagayo-ng/rsrc/mouths/4 — Preston Blair [‘L.jpg’, ‘O.jpg’, ‘FV.jpg’, ‘etc.jpg’, ‘MBP.jpg’, ‘U.jpg’, ‘rest.jpg’, ‘AI.jpg’, ‘E.jpg’, ‘WQ.jpg’]
[‘AllowNestedDocks’, ‘AllowTabbedDocks’, ‘AnimatedDocks’, ‘DockOption’, ‘DockOptions’, ‘DrawChildren’, ‘DrawWindowBackground’, ‘ForceTabbedDocks’, ‘GroupedDragging’, ‘IgnoreMask’, ‘PaintDeviceMetric’, ‘PdmDepth’, ‘PdmDevicePixelRatio’, ‘PdmDevicePixelRatioScaled’, ‘PdmDpiX’, ‘PdmDpiY’, ‘PdmHeight’, ‘PdmHeightMM’, ‘PdmNumColors’, ‘PdmPhysicalDpiX’, ‘PdmPhysicalDpiY’, ‘PdmWidth’, ‘PdmWidthMM’, ‘RenderFlag’, ‘RenderFlags’, ‘VerticalTabs’, ‘class‘, ‘delattr‘, ‘dict‘, ‘dir‘, ‘doc‘, ‘eq‘, ‘format‘, ‘ge‘, ‘getattribute‘, ‘gt‘, ‘hash‘, ‘init‘, ‘init_subclass‘, ‘le‘, ‘lt‘, ‘module‘, ‘ne‘, ‘new‘, ‘reduce‘, ‘reduce_ex‘, ‘repr‘, ‘setattr‘, ‘sizeof‘, ‘str‘, ‘subclasshook‘, ‘acceptDrops’, ‘accessibleDescription’, ‘accessibleName’, ‘actionEvent’, ‘action_about_papagayo_ng’, ‘action_copy’, ‘action_cut’, ‘action_exit’, ‘action_help_topics’, ‘action_open’, ‘action_paste’, ‘action_play’, ‘action_reset_zoom’, ‘action_save’, ‘action_save_as’, ‘action_stop’, ‘action_undo’, ‘action_zoom_in’, ‘action_zoom_out’, ‘actions’, ‘activateWindow’, ‘addAction’, ‘addActions’, ‘addDockWidget’, ‘addToolBar’, ‘addToolBarBreak’, ‘adjustSize’, ‘autoFillBackground’, ‘backgroundRole’, ‘backingStore’, ‘baseSize’, ‘blockSignals’, ‘breakdown_button’, ‘centralWidget’, ‘central_widget’, ‘changeEvent’, ‘childAt’, ‘childEvent’, ‘children’, ‘childrenRect’, ‘childrenRegion’, ‘choose_imageset_button’, ‘clearFocus’, ‘clearMask’, ‘close’, ‘closeEvent’, ‘colorCount’, ‘connect’, ‘connectNotify’, ‘contentsMargins’, ‘contentsRect’, ‘contextMenuEvent’, ‘contextMenuPolicy’, ‘corner’, ‘create’, ‘createPopupMenu’, ‘createWinId’, ‘createWindowContainer’, ‘current_voice’, ‘cursor’, ‘customContextMenuRequested’, ‘customEvent’, ‘deleteLater’, ‘delete_button’, ‘depth’, ‘destroy’, ‘destroyed’, ‘devType’, ‘devicePixelRatio’, ‘devicePixelRatioF’, ‘devicePixelRatioFScale’, ‘disconnect’, ‘disconnectNotify’, ‘dockOptions’, ‘dockWidgetArea’, ‘documentMode’, ‘dragEnterEvent’, ‘dragLeaveEvent’, ‘dragMoveEvent’, ‘dropEvent’, ‘dumpObjectInfo’, ‘dumpObjectTree’, ‘dynamicPropertyNames’, ‘effectiveWinId’, ’emit’, ‘ensurePolished’, ‘enterEvent’, ‘event’, ‘eventFilter’, ‘export_button’, ‘export_combo’, ‘export_group’, ‘export_layout’, ‘find’, ‘findChild’, ‘findChildren’, ‘focusInEvent’, ‘focusNextChild’, ‘focusNextPrevChild’, ‘focusOutEvent’, ‘focusPolicy’, ‘focusPreviousChild’, ‘focusProxy’, ‘focusWidget’, ‘font’, ‘fontInfo’, ‘fontMetrics’, ‘foregroundRole’, ‘fps’, ‘fps_controls’, ‘fps_input’, ‘frameGeometry’, ‘frameSize’, ‘geometry’, ‘getContentsMargins’, ‘grab’, ‘grabGesture’, ‘grabKeyboard’, ‘grabMouse’, ‘grabShortcut’, ‘graphicsEffect’, ‘graphicsProxyWidget’, ‘hasFocus’, ‘hasHeightForWidth’, ‘hasMouseTracking’, ‘hasTabletTracking’, ‘height’, ‘heightForWidth’, ‘heightMM’, ‘hide’, ‘hideEvent’, ‘horizontalLayout’, ‘horizontalLayout_2’, ‘horizontalLayout_3’, ‘horizontalLayout_4’, ‘horizontal_layout’, ‘iconSize’, ‘iconSizeChanged’, ‘inherits’, ‘initPainter’, ‘inputMethodEvent’, ‘inputMethodHints’, ‘inputMethodQuery’, ‘insertAction’, ‘insertActions’, ‘insertToolBar’, ‘insertToolBarBreak’, ‘installEventFilter’, ‘internalWinId’, ‘isActiveWindow’, ‘isAncestorOf’, ‘isAnimated’, ‘isDockNestingEnabled’, ‘isEnabled’, ‘isEnabledTo’, ‘isEnabledToTLW’, ‘isFullScreen’, ‘isHidden’, ‘isLeftToRight’, ‘isMaximized’, ‘isMinimized’, ‘isModal’, ‘isRightToLeft’, ‘isSeparator’, ‘isSignalConnected’, ‘isTopLevel’, ‘isVisible’, ‘isVisibleTo’, ‘isWidgetType’, ‘isWindow’, ‘isWindowModified’, ‘isWindowType’, ‘keyPressEvent’, ‘keyReleaseEvent’, ‘keyboardGrabber’, ‘killTimer’, ‘language_choice’, ‘layout’, ‘layoutDirection’, ‘leaveEvent’, ‘locale’, ‘logicalDpiX’, ‘logicalDpiY’, ‘lower’, ‘mapFrom’, ‘mapFromGlobal’, ‘mapFromParent’, ‘mapTo’, ‘mapToGlobal’, ‘mapToParent’, ‘mask’, ‘maximumHeight’, ‘maximumSize’, ‘maximumWidth’, ‘menuBar’, ‘menuWidget’, ‘menu_edit’, ‘menu_file’, ‘menu_help’, ‘menubar’, ‘metaObject’, ‘metric’, ‘minimumHeight’, ‘minimumSize’, ‘minimumSizeHint’, ‘minimumWidth’, ‘mouseDoubleClickEvent’, ‘mouseGrabber’, ‘mouseMoveEvent’, ‘mousePressEvent’, ‘mouseReleaseEvent’, ‘mouth_choice’, ‘mouth_view’, ‘move’, ‘moveEvent’, ‘moveToThread’, ‘nativeEvent’, ‘nativeParentWidget’, ‘new_button’, ‘nextInFocusChain’, ‘normalGeometry’, ‘objectName’, ‘objectNameChanged’, ‘overrideWindowFlags’, ‘overrideWindowState’, ‘paintEngine’, ‘paintEvent’, ‘painters’, ‘paintingActive’, ‘palette’, ‘parent’, ‘parentWidget’, ‘phoneme_group’, ‘phoneme_layout’, ‘phoneme_set’, ‘physicalDpiX’, ‘physicalDpiY’, ‘pos’, ‘previousInFocusChain’, ‘property’, ‘raise_’, ‘receivers’, ‘rect’, ‘redirected’, ‘registerUserData’, ‘releaseKeyboard’, ‘releaseMouse’, ‘releaseShortcut’, ‘reload_dict_button’, ‘removeAction’, ‘removeDockWidget’, ‘removeEventFilter’, ‘removeToolBar’, ‘removeToolBarBreak’, ‘render’, ‘repaint’, ‘resize’, ‘resizeDocks’, ‘resizeEvent’, ‘restoreDockWidget’, ‘restoreGeometry’, ‘restoreState’, ‘saveGeometry’, ‘saveState’, ‘scroll’, ‘sender’, ‘senderSignalIndex’, ‘setAcceptDrops’, ‘setAccessibleDescription’, ‘setAccessibleName’, ‘setAnimated’, ‘setAttribute’, ‘setAutoFillBackground’, ‘setBackgroundRole’, ‘setBaseSize’, ‘setCentralWidget’, ‘setContentsMargins’, ‘setContextMenuPolicy’, ‘setCorner’, ‘setCursor’, ‘setDisabled’, ‘setDockNestingEnabled’, ‘setDockOptions’, ‘setDocumentMode’, ‘setEnabled’, ‘setFixedHeight’, ‘setFixedSize’, ‘setFixedWidth’, ‘setFocus’, ‘setFocusPolicy’, ‘setFocusProxy’, ‘setFont’, ‘setForegroundRole’, ‘setGeometry’, ‘setGraphicsEffect’, ‘setHidden’, ‘setIconSize’, ‘setInputMethodHints’, ‘setLayout’, ‘setLayoutDirection’, ‘setLocale’, ‘setMask’, ‘setMaximumHeight’, ‘setMaximumSize’, ‘setMaximumWidth’, ‘setMenuBar’, ‘setMenuWidget’, ‘setMinimumHeight’, ‘setMinimumSize’, ‘setMinimumWidth’, ‘setMouseTracking’, ‘setObjectName’, ‘setPalette’, ‘setParent’, ‘setProperty’, ‘setShortcutAutoRepeat’, ‘setShortcutEnabled’, ‘setSizeIncrement’, ‘setSizePolicy’, ‘setStatusBar’, ‘setStatusTip’, ‘setStyle’, ‘setStyleSheet’, ‘setTabOrder’, ‘setTabPosition’, ‘setTabShape’, ‘setTabletTracking’, ‘setToolButtonStyle’, ‘setToolTip’, ‘setToolTipDuration’, ‘setUnifiedTitleAndToolBarOnMac’, ‘setUpdatesEnabled’, ‘setVisible’, ‘setWhatsThis’, ‘setWindowFilePath’, ‘setWindowFlag’, ‘setWindowFlags’, ‘setWindowIcon’, ‘setWindowIconText’, ‘setWindowModality’, ‘setWindowModified’, ‘setWindowOpacity’, ‘setWindowRole’, ‘setWindowState’, ‘setWindowTitle’, ‘sharedPainter’, ‘show’, ‘showEvent’, ‘showFullScreen’, ‘showMaximized’, ‘showMinimized’, ‘showNormal’, ‘signalsBlocked’, ‘size’, ‘sizeHint’, ‘sizeIncrement’, ‘sizePolicy’, ‘splitDockWidget’, ‘stackUnder’, ‘startTimer’, ‘staticMetaObject’, ‘statusBar’, ‘statusTip’, ‘statusbar’, ‘style’, ‘styleSheet’, ‘tabPosition’, ‘tabShape’, ‘tabifiedDockWidgetActivated’, ‘tabifiedDockWidgets’, ‘tabifyDockWidget’, ‘tabletEvent’, ‘takeCentralWidget’, ‘testAttribute’, ‘text_edit’, ‘text_input_group’, ‘thread’, ‘timerEvent’, ‘toolBarArea’, ‘toolBarBreak’, ‘toolButtonStyle’, ‘toolButtonStyleChanged’, ‘toolTip’, ‘toolTipDuration’, ‘toolbar’, ‘topLevelWidget’, ‘tr’, ‘underMouse’, ‘ungrabGesture’, ‘unifiedTitleAndToolBarOnMac’, ‘unsetCursor’, ‘unsetLayoutDirection’, ‘unsetLocale’, ‘update’, ‘updateGeometry’, ‘updateMicroFocus’, ‘updatesEnabled’, ‘verticalLayout’, ‘verticalLayout_2’, ‘verticalLayout_4’, ‘verticalLayout_5’, ‘verticalLayout_6’, ‘vertical_layout_left’, ‘vertical_layout_left_1’, ‘vertical_layout_right’, ‘visibleRegion’, ‘voice_list’, ‘voice_list_buttons’, ‘voice_list_group’, ‘voice_name’, ‘voice_name_input’, ‘voice_name_layout’, ‘volume_slider’, ‘waveform_view’, ‘whatsThis’, ‘wheelEvent’, ‘width’, ‘widthMM’, ‘winId’, ‘window’, ‘windowFilePath’, ‘windowFlags’, ‘windowHandle’, ‘windowIcon’, ‘windowIconChanged’, ‘windowIconText’, ‘windowIconTextChanged’, ‘windowModality’, ‘windowOpacity’, ‘windowRole’, ‘windowState’, ‘windowTitle’, ‘windowTitleChanged’, ‘windowType’, ‘x’, ‘y’]
[‘1 — Mouth 1’, ‘2 — Mouth 2’, ‘3 — Gary C Martin’, ‘4 — Preston Blair’, ‘5 — Fleming and Dobbs’, ‘6 — Azia Comics 1 (preston_blair)’, ‘7 — Azia Comics 2 (preston_blair)’, ‘8 — Rhubarb’]
import phonemes_preston_blair as phonemeset
/Users/taji/Desktop
objc[86401]: Class FIFinderSyncExtensionHost is implemented in both /System/Library/PrivateFrameworks/FinderKit.framework/Versions/A/FinderKit (0x7fffae41e1d0) and /System/Library/PrivateFrameworks/FileProvider.framework/OverrideBundles/FinderSyncCollaborationFileProviderOverride.bundle/Contents/MacOS/FinderSyncCollaborationFileProviderOverride (0x12dfb2dc8). One of the two will be used. Which one is undefined.
/Users/taji/Desktop/lame.wav
/Users/taji/Desktop
defaultServiceProvider::requestService(): no service found for — «org.qt-project.qt.audiodecode»
Changed!
4026
—— End of Log ——

Mhh, a bit of googling shows that this seems to be a bug for QT on OSX.
https://lists.qt-project.org/pipermail/interest/2013-March/006438.html
More currently it seems to be this bug:
https://bugreports.qt.io/browse/QTBUG-50820
And as far as I can see this has not been fixed yet. Someone with an OSX machine should bump that bug.
How annoying, so on OSX we should fall back to the old method then until that is fixed.

Sorry to hear that. 🙂

Let me know if you implement the fallback and I’ll test it. In the meantime, I’m a bit rusty with Python, but will try to get papayago-ng loaded into a debugger so I can assist with testing and debugging.

Well, I’ve just pushed a small update to my fork.
It’s a quick amalgamation that combines the playback via QMediaPlayer with the old waveform generation.
I’ve also added a check so it’s only used on OSX.

Источник

Итак, я сделал аудиоплеер, он загружает аудио с помощью YT-DLP, а затем воспроизводит его с помощью pygame.mixer.

основная проблема, которую я получаю, заключается в том, что pygame не будет запускать этот звук, вместо этого он будет просто выдавать ошибки для различных аудиоформатов, таких как Wav, Ogg и Mp3.

Для формата Wav я получаю эту ошибку: pygame.error: Unknown WAVE format

Для MP3 я получаю эту ошибку: pygame.error: mpg123_seek: Invalid RVA mode. (code 12)

Для Ogg я получаю эту ошибку: pygame.error: Not an Ogg Vorbis audio stream

Поразмыслив некоторое время над этими вещами, я подумал, что что-то не так с кодеками. Ниже прикреплены изображения двух аудиофайлов (один из которых воспроизводится с помощью pygame, а другой выдает ошибки)

Рабочий аудиофайл и Не работает

Для справки

Вот код yt-dlp, который я использовал для загрузки нужного аудиофайла.

from  yt_dlp import YoutubeDL
(option,C1,C2,C3)=[dict(extractaudio=True,outtmpl='src/backend/temp_audio/%(title)s.mp3'),'https://youtu.be','https://youtube.com','https://www.youtube.com',]

def download_song(link):
        try:
            with YoutubeDL(option) as ydl:
                ydl.download([link])
        except:
            print("Error in Downloading : " + link )
            pass
            

Команда для установки необходимого компонента: python -m pip install yt-dlp

Кроме того, для быстрого обзора, вот ссылка на тестовый аудиофайл, который я хотел играть в .

1 ответ

Лучший ответ

Задача решена

После опроса множества людей на серверах Discord о Pygame и yt-dlp.

Что я нашел?

  • pygame не сможет воспроизвести аудиофайл с этими спецификациями.
  • мы можем использовать yt-dlp с ffmpeg, чтобы изменить аудио, чтобы сделать его совместимым с pygame.

Итак, как мы можем установить ffmpeg:

  1. Загрузите ffmpeg: ( https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip)

  2. Извлеките файлы и найдите ffmpeg.exe и ffprobe.exe в папке bin.

  3. Скопируйте эти два файла в ту же папку, что и ваш скрипт.

Сейчас же

После установки ffmpeg нам нужно внести некоторые изменения в код нашего yt-dlp, чтобы он работал с ffmpeg. Ниже представлен новый код:

from  yt_dlp import YoutubeDL

option={'final_ext': 'mp3',
 'format': 'bestaudio/best',
 'postprocessors': [{'key': 'FFmpegExtractAudio',
                     'nopostoverwrites': False,
                     'preferredcodec': 'mp3',
                     'preferredquality': '5'}],
 'outtmpl': 'src/backend/temp_audio/%(title)s.%(ext)s',
 'ffmpeg_location': 'YOUR-LOCATION/ffmpeg.exe'}

def download_song(link):
        try:
            with YoutubeDL(option) as ydl:
                ydl.download([link])
        except:
            print(Exception)
            pass

Теперь ваши аудиофайлы будут отлично работать с pygame!


1

2 revs
11 Июл 2022 в 06:11

iamDyeus

Guest


  • #1

iamDyeus Asks: pygame Error : Unknown WAVE format & mpg123_seek: Invalid RVA mode
So i was making an Audio Player, it downloads audio using YT-DLP and then plays it using pygame.mixer.

the main problem, i am getting is that pygame Won’t Run that Audio instead it would Just give Errors for Different-Different audio Formats like Wav and Mp3.

For Wav Format i get this Error : pygame.error: Unknown WAVE format

while for MP3 i get this one : pygame.error: mpg123_seek: Invalid RVA mode. (code 12)

Also I think there is Something Wrong with the Codecs.

Below are Two Files, one which Runs with pygame and one which doesn’t.

Working Audio File

Not Working one

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, solveforum.

  • xghkxghk
  • 21 minutes ago
  • Main forum
  • Replies: 0

Customized Magnetic Active Buzzer Technical parameters Measuring condition Part shall be measured under a condition (Temperature: 5锝?5鈩? Humidity: 45%锝?5%R.H., Atmospheric pressure: 860 锝?060hPa) unless the standard condition (Temperature: 25卤3鈩? Humidity: 60卤10%R.H. Atmospheric pressure: 860 锝?060hPa) is regulated to measure. 1Rated Voltage3Vo-p 2Operating Voltage2-5Vo-p 3Rated CurrentMax.80mA, at 2048Hz 50% duty Square Wave 3Vo-p 4Sound Output at 10cmMin.85dB, at 2048Hz 50% duty Square Wave 3Vo-p 5Coil Resistance16卤4惟 6Resonant Frequency2048Hz 7Operating Temperature-20鈩冿綖+70鈩?/p> 8Store Temperature-30鈩冿綖+80鈩?/p> 9Net WeightApprox 1.6g 10RoHSYes DRAWING & DIMENSION *Unit: mm; Tolerance: 卤0.5mm Except Specified *Housing Material: Black PBT Frequency Response 3Vo-p 50% duty Square wave,10cm Packing Application Delivery, shipping and service Advantage 1. Technology: We owned injection mould workshop, 3D printer, 3 meter anechoic room, to help customer products and effectively shorten the customer developing time. 2. Patent: We are a innovation-driven company, we have 25 patents include with 2 patents for invention 3. Rich production experience: We specialize in the production of buzzers, speaker alarms and ultrasonic sensors with 25 years of experience. FAQ Q: Are you trading company or manufacturer ? A: We are manufacture ,and we have built up our company since 2010 Q: Do you support OEM and ODM services锛?/strong> A: Yes, surely support.we can customize products according to the drawing.Customized Magnetic Active Buzzer website:http://www.czfhds.com/magnetic-buzzer/magnetic-active-buzzer/

  • Sam
  • 25 minutes ago
  • Social
  • Replies: 0

Sam Asks: Clavinova CLP-230 M
I’m looking at a used Clavinova CLP-230M (thats what I was told was the model). Looks like in good nick. Any idea what I should be paying for it?

Thanks

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • Larry G. Wapnitsky
  • 25 minutes ago
  • Social
  • Replies: 0

Larry G. Wapnitsky Asks: Upgrading to LED. Tombstone question
I am upgrading the bulbs in an old fluorescent work light to LED bulbs. I have pulled the ballasts, and remove the starters from the Tombstones pictured below. Is it safe to use these tombstones without the starters in them, or is there a replacement I should look for?

enter image description here

enter image description here

enter image description here

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • Sega dude
  • 26 minutes ago
  • Computer Science
  • Replies: 0

Sega dude Asks: Definition of the term «small systems» in computer science
What is the definition of the term «small systems» in the context of computer science? My professor didn’t really define the term, they just gave examples of some small systems. I’m having a hard time finding a concrete definition of the term online. This is not a homework question. I just want to know the definition so I can better understand the course.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • pron
  • 26 minutes ago
  • Computer Science
  • Replies: 0

pron Asks: What is the complexity for the universality problem for a NFA with all states accepting?
It is well known that the universality problem for NFA (deciding whether $L(A)=Sigma^*$) is $PSPACE$-complete. However, what if every state of the NFA is known to be accepting? It seems to me that the problem is at most in $co$-$NP$, as a counterexample (unlike in the case of a general NFA) is polynomial (even linear) in the size of the input (the number of states). What is the complexity of this problem?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • George
  • 26 minutes ago
  • Education
  • Replies: 0

George Asks: Expectation of squared integral over distribution
Right now, I have some function $g(x)$ where $E[g(x)]$ is known, and I want to upper bound (or compute if at all possible) $I=Eleft[left(int g(x)^frac{1}{2},dP_x right)^2right]$

What I tried:

First divide up the integral as a double integral $I=Eleft[iint g(x)^frac{1}{2} g(y)^frac{1}{2},dP_xdP_y right]$ where $x$ and $y$ have identical distributions, then pull in the expectation $I=iint Eleft[g(x)^frac{1}{2} g(y)^frac{1}{2}right],dP_xdP_y $. Then, split the expectation by the product $I=iint Eleft[g(x)^frac{1}{2}right] Eleft[g(y)^frac{1}{2}right],dP_xdP_y $, and then use Jensen’s equality to finish with $I<iint Eleft[g(x)right]^frac{1}{2} Eleft[g(y)right]^frac{1}{2},dP_xdP_y$, where this bound is computed by Monte Carlo approximation

However, I am not sure about the assumptions I’ve made in getting to the end result, nor do I feel this bound is very sharp or efficient- did I make any mistakes along the way, and/or is there a better way of handling this?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

  • awesome6uy
  • 26 minutes ago
  • Education
  • Replies: 0

awesome6uy Asks: Statistical test for significant change in regression parameter with new data?
Is there a statistical test that determines if there is a significant change in a regression coefficient parameter’s value when more data is added?

For example, you have 11 months of data, fit a regression model for variable x1 which has an estimated coefficient of 0.8. Next month, you get another set of data and refit the model using the full 12 months of data and get a coefficient of 0.9.

How do I tell if there is a significant change in this parameter value between the two models?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

Понравилась статья? Поделить с друзьями:
  • Putty ssh network error connection refused
  • Pygame error unable to open file
  • Putty permission denied как исправить
  • Putty network error network is unreachable
  • Pygame error text has zero width