for learning C# I have created a sample project. I choose the NAudio library to play around with sound interfaces in Windows. Starting from this point the C# project grows :-).
It currently contains the following “approaches”.
- Store and restore program settings (SpotifyRecorderNGMain.cs)
- Read strings from a dll by its index (StringLoader.cs)
- Read extended Fileattributes or Properties, i.e length of a MP3 file, by WindowsAPICodePack (MP3Details.cs)
- Read STDOUT/STDERR from a child process asynchronous (lame.cs)
- Start a process and wait for exit asynchronous (Lame.cs)
- Record sound from the loopback audio device (Recorder.cs)
- Convert the recorded PCM wav stream to a mp3 file by calling lame.exe (Lame.cs)
- Control the volume of an Audiosession (Sound.cs)
- Mute an Audiosession (Sound.cs)
- Detect volume changes of Audiosessions and Devices (Sound.cs)
- Query a Webservice (POST) for Audio Metadata (Metadata.cs)
- Process the XML Response (Metadata.cs)
- Read Webpages and Images over http/https (Metadata.cs)
- Bind datagridview to a class
See source code for further details.
By finding an application in which I can combine all of them a Spotify Recorder was born. Note that Spotify does NOT allow copying, redistributing, reproducing, “ripping”, recording, transferring any part of its service or content!
Use this Project only for learning purposes. It’s not perfect. Let me know if you have any improvements.
If you want to compile it yourself and you want to use Audioscrobbler you have to add a valid API Key for last.fm into the ApiKey variable metadata.cs line 18. Unfortunately it is currently not possible to create new ones 🙁
In the bin\ Folder of the ZIP package you can find precompiled versions where you can see how the program works. Start Spotify, play any Song and press “Start Recording”.