There is a search box the at bottom of the forum which works far better than google does most days (this question has been answered on a fair few occasions but oh well) but generally there are four ways.
Note: this is for the extremely popular SDAT format used in the vast majority of games; it is still a talking point when games come out using another sound format which even then is usually a somewhat common format like wave (Electroplankton) or ahx/ADX (TWEWY) or PCM:
http://gbatemp.net/index.php?showtopic=102645 (N+).
1) and 2) did have sites/forum threads but they are not with us these days. 1) should have source with it. Those links are my 4shared site so they should be around for some time to come and please feel free to share them. ndssndext should be able to parse the standard DS file system (not sure about VGMtrans but it is no hassle to grab the SDAT file from a rom using ndstool (frontends DSLazy and DSBuff), ndsts, ndshv, crystaltile2, nitroexplorer or even by hand.
1) ndssndext:
http://www.4shared.com/file/68276816/80922...sndext_v04.html
2) VGMtrans:
http://www.4shared.com/file/76520093/5a299676/VGMTrans.html
What is better between 1) and 2) seems to vary between person, game and ambient temperature.
3) loopback from an emulator. As the "title" implies you take an emulator and use the loopback feature of most soundcards to record the music into a player. Your emulator should have the option to removed channels too which means no need to have the near inevitable gunshots, battle sounds, menu sounds and the like once you find which channel holds the undesirable sounds.
4) crystaltile2: not really a method per se but the program does have sound playback abilities which you can use like method 3 above. They are somewhat broken and/or fiddly for most people though.
Oh and for giggles here is the SDAT spec:
http://kiwi.ds.googlepages.com/sdat.html