The smell of freshly burnt marijuana (at least in the Commonwealth of Massachusetts), does establish probable cause to search a vehicle. To be arrested for loud music, alone, seems unreasonable, and would probably be in violation of the Fourth amend. Just because the law gives the police a hammer, doesn't mean they have to swing it. If this arrest occured at night, the courts would probably let the officer pass with is pat search due the fact that was conducting a Terry frisk (safety pat down for weapons) and in the process he felt what he could easily identity as pills (this will be a stretch for him to prove). Pills being out of their medical containers would probably constitute reasonable suspicion, not probable cause to arrest you for them alone, but detain to you so he could conduct a field investigation on the pills....which is why he went with the noise violation. That violation is probably an ordinance and not a law, in which may soon be deemed a none-arrestable offense, if you persue this matter further. Simply put, how much effort are you willing to put into this?