This study explores the use of machine learning for real-time detection of engine knocking, aiming to enhance early vehicle fault recognition. We extracted frequency modulation amplitude demodulation (FMAD) features from engine sound data and evaluated various machine-learning algorithms using MATLAB. The coarse decision tree algorithm emerged as the most effective, achieving a classification accuracy of 66.01%. Subsequently, by using deep learning models, we significantly improved the accuracy: a convolutional neural network (CNN) achieved 45.16%. accuracy, a deep learning recurrent neural network (RNN) model in LSTM achieved 90% accuracy, and further refinements pushed the accuracy to 93.55%. Additionally, we introduced a knock index to quantify noise levels during each engine cycle. This index, calculated from the integral of the absolute value of the first derivative of a band-pass-filtered vibration signal, provides a visual representation of knock strength. This approach shows promise for early detection of engine knocking, although further refinement of feature extraction methods and algorithm optimization is necessary for practical application. The study highlights the potential of integrating machine learning into real-time vehicle fault detection systems to improve their reliability and effectiveness.