Help with Python/Eyed3 MusicCDIdFrame method
Hi,
I’m trying to get the ID3 tags of an mp3 file. I trying to use the
MusicCDIdFrame
method but I can’t seem to get it right. Here is a code snippet:
import eyed3
import eyed3.id3
import eyed3.id3.frames
import eyed3.id3.apple
import eyed3.mp3
myID3 = eyed3.load("/Users/Test/Life in the fast lane.mp3")
myTitle = myID3.tag.title
myArtist = myID3.tag.artist
myAlbum = myID3.tag.album
myAlbumArtist = myID3.tag.album_artist
myComposer = myID3.tag.composer
myPublisher = myID3.tag.publisher
myGenre = myID3.tag.genre.name
myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
When I run this, I get the following error:
File "/Documents/Python/Test1/main.py", line 94, in
myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
AttributeError: 'Mp3AudioFile' object has no attribute 'id3'
Any help or suggestion greatly appreciated.
All the Best
Dave
--
https://mail.python.org/mailman/listinfo/python-list
Re: Tkinter: multicolumn table widget
On Tue, 31 May 2022, MRAB wrote: There's an example of how to show a tooltip here: https://stackoverflow.com/questions/3221956/how-do-i-display-tooltips-in-tkinter MRAB, A tooltip would work. I downloaded the first example and assume that it will display a treeview cell when the cursor hovers over it without needing to be limited to a single column. When I test the module (I'm still writing it) I'll learn what needs fixing. Thanks very much, Rich -- https://mail.python.org/mailman/listinfo/python-list
Re: Automatic Gain Control in Python?
Chris Angelico wrote: > > General principle: If you're asking someone else for help, don't tell > them that your way is easier, because the obvious response is "go > ahead then, do it your own way". *Ding Ding Ding*...We have a winner! At least, that's where I dropped off. My experienced advice is all wrong for you? Sorry I couldn't help more. Good luck to you. > You're technically right in a sense: something that you already have > is, indeed, easier than something else. But downloading files is > *easy* in Python, and audio analysis on files is FAR easier than > real-time audio analysis with hysteresis avoidance. Also this. > Unless you have a really good > reason for sticking to the black-box system, I would strongly > recommend going for the much much easier method of simply downloading > the files as they are. As pretty much everyone else has said. Insisting on real-time processing of something that is itself pre-recorded is non-sensical. Phil -- AH#61 Wolf#14 BS#89 bus#1 CCB#1 SENS KOTC#4 [email protected] http://philb.ca -- https://mail.python.org/mailman/listinfo/python-list
Re: Help with Python/Eyed3 MusicCDIdFrame method
On 2022-06-06 11:37, Dave wrote:
Hi,
I’m trying to get the ID3 tags of an mp3 file. I trying to use the
MusicCDIdFrame
method but I can’t seem to get it right. Here is a code snippet:
import eyed3
import eyed3.id3
import eyed3.id3.frames
import eyed3.id3.apple
import eyed3.mp3
myID3 = eyed3.load("/Users/Test/Life in the fast lane.mp3")
myTitle = myID3.tag.title
myArtist = myID3.tag.artist
myAlbum = myID3.tag.album
myAlbumArtist = myID3.tag.album_artist
myComposer = myID3.tag.composer
myPublisher = myID3.tag.publisher
myGenre = myID3.tag.genre.name
myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
When I run this, I get the following error:
File "/Documents/Python/Test1/main.py", line 94, in
myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
AttributeError: 'Mp3AudioFile' object has no attribute 'id3'
Any help or suggestion greatly appreciated.
That line should be:
myCDID = eyed3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
Also remember that some attributes might be None, e.g. 'myID3.tag.genre'
might be None.
Another point: it's probably not worth importing the submodules of
'eyed3'; you're not gaining anything from it.
--
https://mail.python.org/mailman/listinfo/python-list
Re: Automatic Gain Control in Python?
On 2022-06-06, Phil Boutros wrote: > As pretty much everyone else has said. Insisting on real-time > processing of something that is itself pre-recorded is non-sensical. Downnloading a file, normalizing/compressing the volume, and then streaming the result is three lines in a bash script (assuming you've got wget, sox, and vlc installed). I assume that something similar could be done in PowerShell on Windows. With the right libraries, it's probably about the same in Python. -- Grant -- https://mail.python.org/mailman/listinfo/python-list
Re: Automatic Gain Control in Python?
Steve GS wrote: > > Maybe you do not understand smart speakers. That is exactly what they do. > You tell them what podcast/broadcast to play, they get it and play it for > you. It is that simple. > > All I want to do is change the audio levels automatically to make it easier > on the ear. Once again, what you are telling the speaker to play is a pre-recorded file. Grab it. Normalize it however you want (compared to others, compared to set specs, compared to whatever tickles your fancy). Tell the speaker to play *that* file instead. Done. Phil -- AH#61 Wolf#14 BS#89 bus#1 CCB#1 SENS KOTC#4 [email protected] http://philb.ca -- https://mail.python.org/mailman/listinfo/python-list
[RELEASE] Python 3.10.5 is available
The latest bugfix drop for Python 3.10 is here: Python 3.10.5. This release packs more than 230 bugfixes and docs changes, so you surely want to update :) You can get it here: https://www.python.org/downloads/release/python-3105/ ## This is the fourth maintenance release of Python 3.10 Python 3.10.5 is the newest major release of the Python programming language, and it contains many new features and optimizations. # Major new features of the 3.10 series, compared to 3.9 Among the new major new features and changes so far: * [PEP 623](https://www.python.org/dev/peps/pep-0623/) -- Deprecate and prepare for the removal of the wstr member in PyUnicodeObject. * [PEP 604](https://www.python.org/dev/peps/pep-0604/) -- Allow writing union types as X | Y * [PEP 612](https://www.python.org/dev/peps/pep-0612/) -- Parameter Specification Variables * [PEP 626](https://www.python.org/dev/peps/pep-0626/) -- Precise line numbers for debugging and other tools. * [PEP 618 ](https://www.python.org/dev/peps/pep-0618/) -- Add Optional Length-Checking To zip. * [bpo-12782](https://bugs.python.org/issue12782): Parenthesized context managers are now officially allowed. * [PEP 632 ](https://www.python.org/dev/peps/pep-0632/) -- Deprecate distutils module. * [PEP 613 ](https://www.python.org/dev/peps/pep-0613/) -- Explicit Type Aliases * [PEP 634 ](https://www.python.org/dev/peps/pep-0634/) -- Structural Pattern Matching: Specification * [PEP 635 ](https://www.python.org/dev/peps/pep-0635/) -- Structural Pattern Matching: Motivation and Rationale * [PEP 636 ](https://www.python.org/dev/peps/pep-0636/) -- Structural Pattern Matching: Tutorial * [PEP 644 ](https://www.python.org/dev/peps/pep-0644/) -- Require OpenSSL 1.1.1 or newer * [PEP 624 ](https://www.python.org/dev/peps/pep-0624/) -- Remove Py_UNICODE encoder APIs * [PEP 597 ](https://www.python.org/dev/peps/pep-0597/) -- Add optional EncodingWarning [bpo-38605](https://bugs.python.org/issue38605): `from __future__ import annotations` ([PEP 563](https://www.python.org/dev/peps/pep-0563/)) used to be on this list in previous pre-releases but it has been postponed to Python 3.11 due to some compatibility concerns. You can read the Steering Council communication about it [here]( https://mail.python.org/archives/list/[email protected]/thread/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/) to learn more. # More resources * [Changelog](https://docs.python.org/3.10/whatsnew/changelog.html#changelog ) * [Online Documentation](https://docs.python.org/3.10/) * [PEP 619](https://www.python.org/dev/peps/pep-0619/), 3.10 Release Schedule * Report bugs at [https://bugs.python.org](https://bugs.python.org). * [Help fund Python and its community](/psf/donations/). # And now for something completely different Strange quarks are the third lightest quarks, which are subatomic particles that are so small, they are believed to be the fundamental particles, and not further divisible. Like down quarks, strange quarks have a charge of -1/3. Like all fermions (which are particles that can not exist in the same place at the same time), strange quarks have a spin of 1/2. What makes strange quarks different from down quarks–apart from having 25 times the mass of down quarks–is that they have something that scientists call "strangeness." Strangeness is basically a resistance to decay against strong force and electromagnetism. This means that any particle that contains a strange quark can not decay due to strong force (or electromagnetism), but instead with the much slower weak force. It was believed that this was a 'strange' method of decay, which is why the scientists gave the particles that name. # We hope you enjoy the new releases! Thanks to all of the many volunteers who help make Python Development and these releases possible! Please consider supporting our efforts by volunteering yourself or through organization contributions to the Python Software Foundation. https://www.python.org/psf/ Your friendly release team, Ned Deily @nad https://discuss.python.org/u/nad Steve Dower @steve.dower https://discuss.python.org/u/steve.dower Pablo Galindo Salgado @pablogsal https://discuss.python.org/u/pablogsal -- https://mail.python.org/mailman/listinfo/python-list
Re: Help with Python/Eyed3 MusicCDIdFrame method
Thanks! That fixed it!
> On 6 Jun 2022, at 18:46, MRAB wrote:
>
> On 2022-06-06 11:37, Dave wrote:
>> Hi,
>> I’m trying to get the ID3 tags of an mp3 file. I trying to use the
>> MusicCDIdFrame
>> method but I can’t seem to get it right. Here is a code snippet:
>> import eyed3
>> import eyed3.id3
>> import eyed3.id3.frames
>> import eyed3.id3.apple
>> import eyed3.mp3
>> myID3 = eyed3.load("/Users/Test/Life in the fast lane.mp3")
>> myTitle = myID3.tag.title
>> myArtist = myID3.tag.artist
>> myAlbum = myID3.tag.album
>> myAlbumArtist = myID3.tag.album_artist
>> myComposer = myID3.tag.composer
>> myPublisher = myID3.tag.publisher
>> myGenre = myID3.tag.genre.name
>> myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
>> When I run this, I get the following error:
>> File "/Documents/Python/Test1/main.py", line 94, in
>> myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
>> AttributeError: 'Mp3AudioFile' object has no attribute 'id3'
>> Any help or suggestion greatly appreciated.
> That line should be:
>
> myCDID = eyed3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
>
> Also remember that some attributes might be None, e.g. 'myID3.tag.genre'
> might be None.
>
> Another point: it's probably not worth importing the submodules of 'eyed3';
> you're not gaining anything from it.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
https://mail.python.org/mailman/listinfo/python-list
RE: Automatic Gain Control in Python?
Yes, it is real-time play back of a pre-recorded presentation. A juke box does the same thing. It plays records. You didn't put your quarter in to expect the band to play your piece live, did you? Same here, I am pulling in the programs and playing them for an audience. All I want to do is have some semblance of AGC audio since the sources don't seem to be able to do it. " I would strongly > recommend going for the much much easier method of simply downloading > the files as they are." As Bill Gates would say "You have not understood it from the start." No, downloading the files, all 48 of them every week, is not easier if I have to turn around and replay them through the system. What could be easier than to have the smart speaker do all that work and play the podcasts "live". All I want to do is jump in there between the Smart Speaker and the input to the intercom and twerk the audio a bit. Footnote: If you double major in psychology and reverse psychology, to they cancel each other out? -Original Message- From: Python-list On Behalf Of Phil Boutros Sent: Monday, June 6, 2022 12:39 PM To: [email protected] Subject: Re: Automatic Gain Control in Python? Chris Angelico wrote: > > General principle: If you're asking someone else for help, don't tell > them that your way is easier, because the obvious response is "go > ahead then, do it your own way". *Ding Ding Ding*...We have a winner! At least, that's where I dropped off. My experienced advice is all wrong for you? Sorry I couldn't help more. Good luck to you. > You're technically right in a sense: something that you already have > is, indeed, easier than something else. But downloading files is > *easy* in Python, and audio analysis on files is FAR easier than > real-time audio analysis with hysteresis avoidance. Also this. > Unless you have a really good > reason for sticking to the black-box system, I would strongly > recommend going for the much much easier method of simply downloading > the files as they are. As pretty much everyone else has said. Insisting on real-time processing of something that is itself pre-recorded is non-sensical. Phil -- AH#61 Wolf#14 BS#89 bus#1 CCB#1 SENS KOTC#4 [email protected] http://philb.ca -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Help with Python/Eyed3 MusicCDIdFrame method
On Mon, 6 Jun 2022 12:37:47 +0200, Dave declaimed
the following:
>Hi,
>
>I’m trying to get the ID3 tags of an mp3 file. I trying to use the
>MusicCDIdFrame
> method but I can’t seem to get it right. Here is a code snippet:
>
>
> import eyed3
>import eyed3.id3
>import eyed3.id3.frames
>import eyed3.id3.apple
As I understand the documentation, The last is Apple
specific/non-standard information...
https://eyed3.readthedocs.io/en/latest/eyed3.id3.html
"""
eyed3.id3.apple module
Here lies Apple frames, all of which are non-standard. All of these would
have been standard user text frames by anyone not being a bastard, on
purpose.
"""
{I'm not thrilled by the documentation -- it is basically a collection on
one-line doc-strings with absolutely no hints as to proper usage}
> File "/Documents/Python/Test1/main.py", line 94, in
>myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
>AttributeError: 'Mp3AudioFile' object has no attribute 'id3'
"""
eyed3.core.load(path, tag_version=None)[source]
Loads the file identified by path and returns a concrete type of
eyed3.core.AudioFile. If path is not a file an IOError is raised. None is
returned when the file type (i.e. mime-type) is not recognized. The
following AudioFile types are supported:
eyed3.mp3.Mp3AudioFile - For mp3 audio files.
eyed3.id3.TagFile - For raw ID3 data files.
"""
eyed3.id3. would appear to be specific to non-MP3 data files.
So... I'd try the interactive environment and check each layer...
dir(myID3)
(based upon the error, there will not be a "id3" key; so try
dir(myID3.) for each key you do find).
>
>
>Any help or suggestion greatly appreciated.
>
Given this bit of source code from the documentation...
def initTag(self, version=id3.ID3_DEFAULT_VERSION):
"""Add a id3.Tag to the file (removing any existing tag if one
exists).
"""
self.tag = id3.Tag()
self.tag.version = version
self.tag.file_info = id3.FileInfo(self.path)
return self.tag
... you probably need to be looking at
myID3.tag.
... try
dir(myID3.tag)
and see what all may appear...
IOW: the ID3 information has already been parsed into separate "tag"
fields.
--
Wulfraed Dennis Lee Bieber AF6VN
[email protected]://wlfraed.microdiversity.freeddns.org/
--
https://mail.python.org/mailman/listinfo/python-list
Re: Automatic Gain Control in Python?
Stefan Ram wrote: > > When a mike is used anyway: Some mobile devices have a mike > with AGC in the driver, so they usually record with AGC. In the name of all that is Holy, please don't suggest another intermediary step that may actually be taken seriously here! Do you really want a phone listening to this speaker while recording, and then...er...what? Feed that to the speaker again? This is a level of masochism that the Marquis de Sade would blush at. Phil -- AH#61 Wolf#14 BS#89 bus#1 CCB#1 SENS KOTC#4 [email protected] http://philb.ca -- https://mail.python.org/mailman/listinfo/python-list
Re: Automatic Gain Control in Python?
Steve GS wrote: > Yes, it is real-time play back of a pre-recorded presentation. > A juke box does the same thing. It plays records. > You didn't put your quarter in to expect the band to play your piece live, > did you? > > Same here, I am pulling in the programs and playing them for an audience. > All I want to do is have some semblance of AGC audio since the sources don't > seem to be able to do it. And if your metaphorical jukebox plays digital files, I would expect it to do any modifications to the *file* before playing, not try to modify the output as it analyzed what it was playing via its own output (for some reason), which is vastly more difficult. You're saying it here yourself: "I am pulling in the programs". Good, then modify them *before* playing them? Nope, you insist on getting them playing, then attempting to monitor them and modify them on the fly based on...some parameters that are unclear. But, once again, your way is clearly better, then go ahead and fill your boots on doing it your way. What do we know? Good luck to you. It once again appears that we are at an impasse. Let us know how it works out. Phil -- AH#61 Wolf#14 BS#89 bus#1 CCB#1 SENS KOTC#4 [email protected] http://philb.ca -- https://mail.python.org/mailman/listinfo/python-list
Re: Automatic Gain Control in Python?
Am Mon, Jun 06, 2022 at 02:08:41PM -0400 schrieb Steve GS: > Yes, it is real-time play back of a pre-recorded presentation. ... What all of us around here don't understand is why you insist on not being able to modify the data to your heart's content inbetween this ... > [...] pulling in the programs ... and that ... > and playing them for an audience. ?? IOW, during the "and" phase. Best, Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list
Re: Automatic Gain Control in Python?
On Mon, 06 Jun 2022 10:10:37 -0700 (PDT), Grant Edwards declaimed the following: >On 2022-06-06, Phil Boutros wrote: > >> As pretty much everyone else has said. Insisting on real-time >> processing of something that is itself pre-recorded is non-sensical. > >Downnloading a file, normalizing/compressing the volume, and then >streaming the result is three lines in a bash script (assuming you've >got wget, sox, and vlc installed). I assume that something similar >could be done in PowerShell on Windows. > >With the right libraries, it's probably about the same in Python. I would like to point out that "normalization" is not the same as "AGC", which is not the same as "compression"... So what really is desired here? Normalization MUST have the entire file available, as it needs to know the peak signal and adjusts the entire file to maximize the peak. AGC in contrast is a sliding window operation which attempts to level out the overall signal based upon previous "average". It is not "read a chunk, normalize the chunk, repeat". Aggressive AGC will wipe out any dynamics in an audio signal (I once had a cheap RatShack stereo cassette deck which used a fixed AGC on record -- try to imagine the hash it made when taping the 45rpm record of "The Night Chicago Died"... Every time the drum hit in the opening measures the "sirens" were suppressed only to rise in the interval before the next drum hit). Compression operates sample-by-sample, so can be applied live -- but is best used after the entire audio file has been normalized. Compression (at least as used by me in the past -- Vegas 6) /reduces/ the strong parts of the signal (anything above the specified threshold) by some defined ratio -- then adjusts the entire signal back up to maximize the "reduced" portion, thereby raising everything that fell below the threshold value. There may or may not be some hint of AGC in the algorithm used (the Audacity documents show attack/release settings acting as a limited AGC in that it responds when transitions above and below threshold occur). -- Wulfraed Dennis Lee Bieber AF6VN [email protected]://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list
Filtering XArray Datasets?
I have some large (>100GB) datasets loaded into memory in a two-dimensional (X and Y) NumPy array backed XArray dataset. At one point I want to filter the data using a boolean array created by performing a boolean operation on the dataset that is, I want to filter the dataset for all points with a longitude value greater than, say, 50 and less than 60, just to give an example (hopefully that all makes sense?). Currently I am doing this by creating a boolean array (data[‘latitude’]>50, for example), and then applying that boolean array to the dataset using .where(), with drop=True. This appears to work, but has two issues: 1) It’s slow. On my large datasets, applying where can take several minutes (vs. just seconds to use a boolean array to index a similarly sized numpy array) 2) It uses large amounts of memory (which is REALLY a problem when the array is already using 100GB+) What it looks like is that values corresponding to True in the boolean array are copied to a new XArray object, thereby potentially doubling memory usage until it is complete, at which point the original object can be dropped, thereby freeing the memory. Is there any solution for these issues? Some way to do an in-place filtering? --- Israel Brewster Software Engineer Alaska Volcano Observatory Geophysical Institute - UAF 2156 Koyukuk Drive Fairbanks AK 99775-7320 Work: 907-474-5172 cell: 907-328-9145 -- https://mail.python.org/mailman/listinfo/python-list
Re: Filtering XArray Datasets?
On Mon, 6 Jun 2022 14:28:41 -0800, Israel Brewster declaimed the following: >I have some large (>100GB) datasets loaded into memory in a two-dimensional (X >and Y) NumPy array backed Unless you have some massive number cruncher machine, with TB RAM, you are running with a lot of page swap -- and not just cached pages in unused RAM; actual disk I/O. Pretty much anything that has to scan the data is going to be slow! > >Currently I am doing this by creating a boolean array (data[‘latitude’]>50, >for example), and then applying that boolean array to the dataset using >.where(), with drop=True. This appears to work, but has two issues: > FYI: your first paragraph said "longitude", not "latitude". >1) It’s slow. On my large datasets, applying where can take several minutes >(vs. just seconds to use a boolean array to index a similarly sized numpy >array) >2) It uses large amounts of memory (which is REALLY a problem when the array >is already using 100GB+) > Personally, given the size of the data, and that it is going to involve lots of page swapping... I'd try to convert the datasets into some RDBM -- maybe with indices defined for latitude/longitude columns, allowing queries to scan the index to find matching records, and return those (perhaps for processing one at a time "for rec in cursor:" rather than doing a .fetchall(). Some RDBMs even have extensions for spatial data handling. -- Wulfraed Dennis Lee Bieber AF6VN [email protected]://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list
