Introduction

Wine vinegar is a food product derived from the dual fermentation of grape must. This process involves two primary phases: initially, yeast transforms the sugars in grapes into ethanol (Cozzolino 2016), and subsequently, acetobacteria bio-oxidize ethanol produced in the first phase into acetic acid (Bhat et al. 2014). Achieving full completion of this process may span several weeks when the process is conducted through surface fermentation, requiring periodic monitoring to assess fermentation progression and determine the quantities of its byproducts, such as ethanol content and total acidity.

The increasing need for enhanced product quality and efficiency in vinegar production has induced the gradual shift from conventional, destructive analytical methods to faster, more environmentally sustainable alternatives. Vibrational spectroscopies emerge as a compelling choice to continuously monitor the fermentation stage of grape must, ensuring process control and enabling prompt intervention in case of anomalies during fermentation (Gishen et al. 2005). These techniques offer multiple advantages, being rapid and non-invasive, as they necessitate no prior sample preparation.

Among various vibrational spectroscopies, near-infrared (NIR) spectroscopy stands out for its remarkable versatility. It produces reliable results even when utilized by non-specialized personnel to analyze samples containing bonds such as C − H, N − H, and O − H, with the condition that the analyte concentration is at least 0.1% of the total (Burns and Ciurczak 2007). NIR spectroscopy is exceptionally fast, making it suitable for online implementation in process control, contributing to the ease of automating the control system. On the flip side, the application of this technique initially entails a price to pay, namely, the preliminary work on signals to “train” the system to recognize the relevant features in the sample. NIR spectra serve as a sort of fingerprints of the sample that need to be appropriately “interpreted”; this is done using chemometric methods for spectral analysis, which focus on eliminating irrelevant information and interferences and extracting information useful for solving the problem of interest (Burns and Ciurczak 2007; Ferrari et al. 2011; Foca et al. 2011, 2016; Barbon et al. 2020).

In the literature, numerous works have investigated the processes of alcoholic and acetic fermentation, employing NIR spectroscopy to quantify various analytes indicative of the fermentation stage. Table 1 provides a summary of these articles, highlighting their characteristics. Firstly, some of them specifically focus on the alcoholic fermentation phase (Buratti et al. 2011; Cozzolino et al. 2006; Di Egidio et al. 2010; Frohman and de Orduna Heidinger 2018; Jiménez-Márquez et al. 2016; Kasemsumran et al. 2022; Ouyang et al. 2016; Peng et al. 2016; Ye et al. 2014; Wu et al. 2014), while others concentrate on acetic fermentation (Sedjoah et al. 2021; Chen et al. 2023; González-Sáiz et al. 2008; Phanomsophon et al. 2019; Yano et al. 1997), depending on whether the final product of interest is wine or vinegar, respectively. The articles also differ based on the type of substrate involved in fermentation. Indeed, wine and vinegar can be produced not only from grapes but also from rice, apples, or other cereals or fruits—essentially from any vegetable matrix rich in sugars (Jagtap and Bapat 2015; Solieri and Giudici 2009). Additionally, different articles often consider various spectral ranges for NIR analysis, which can have important implications for the performance of the models.

Table 1 Overview of literature articles addressing the monitoring of alcoholic and acetic fermentation through FT-NIR spectroscopy

To the best of our knowledge, no study has been conducted so far to track the entire progression of the dual surface fermentation, encompassing both phases over an extended time period. In this work, we monitored the course of simultaneous fermentation for two different batches of red grape must, to assess the reproducibility of the process kinetics when musts from different red grape varieties are kept under the same environmental conditions. Fermentation was monitored by analyzing ethanol content and total acidity for almost four months, evaluating the evolution over time of both parameters.

At the same time, grape must samples were analyzed using FT-NIR spectroscopy over a broad spectral range between 12,500 and 4000 cm−1. The resulting spectra, after appropriate preprocessing, were initially explored by Principal Component Analysis (PCA, Bro and Smilde 2014), to visualize in the principal components space how they evolved in the different phases of fermentation.

Subsequently, multivariate calibration models were developed and validated to predict ethanol content and total acidity using Partial Least Squares (PLS, Geladi and Kowalski 1986). Firstly, a PLS model was calculated considering the entire spectral range (12,500–4000 cm−1, equivalent to 800–2500 nm). Then, the feasibility of achieving satisfactory calibration models using narrower spectral regions was also investigated, since this could allow the use of cheaper and miniaturizable sensors with potential applications in portable devices. Specifically, we focused on two spectral regions labeled for simplicity as “NIR1” and “NIR2” covering the ranges 10,526–6060 cm−1 (950–1650 nm) and 12,500–9346 cm−1 (800–1070 nm), respectively. The choice to shorten the spectra to obtain the corresponding signals in these spectral regions is driven by the need to simulate spectra acquired with commercially available devices working in these spectral ranges. The NIR1 region corresponds to the spectral range that could be acquired using an uncooled InGaAs detector, which is significantly more economical than its cooled counterpart. On the other hand, the NIR2 region is towards the NIR region closer to the visible one, which could also allow the use of much cheaper silicon detectors (Wang et al. 2020; Pu et al. 2021).

Monitoring of alcoholic and acetic fermentation in red grape musts through FT-NIR has proven effective in accurately determining ethanol content and total acidity values both considering the entire spectral range and focusing on the region labeled as NIR1. Less satisfactory but still acceptable results were obtained in the region referred to as NIR2, confirming the potential use of simple and cost-effective devices for real-time monitoring of fermenting must.

Materials and Methods

Must Samples and Fermentation Conditions

In this study, two samples of red grape must, referred to as batch A and batch B, both produced in the agricultural year 2022 in Emilia Romagna Region, Italy, were subjected to surface fermentation. Batch A must was from Ancellotta grape variety, while batch B must was from a blend of Lambrusco Salamino and Lambrusco Grasparossa grape varieties.

After pressing the grapes, the grape musts were cooled and stabilized at a temperature between 0 and 4 °C. Subsequently, as the experimentation began, they were brought to room temperature (ranging from 18 to 25 °C during the whole fermentation period) and inoculated with Saccharomyces cerevisiae yeast to initiate the alcoholic fermentation process. Throughout the alcoholic fermentation phase, two aliquots of grape must were collected almost daily for each batch. One was promptly analyzed in the laboratory to determine ethanol content and total acidity, while the other was frozen for subsequent spectroscopic analysis. Starting around the 40th day of fermentation, the acetic bio-oxidation phase began spontaneously (acetobacteria were present in the air of the fermentation room, which is adjacent to a vinegar production area). During this phase, sampling of the two aliquots for each batch was conducted every 2–4 days. In total, 49 samples were collected for batch A and 40 samples for batch B, for which the fermentation process proceeded more rapidly. Monitoring ended after 116 days for batch A and after 80 days for batch B.

Laboratory Analysis and Spectra Acquisition

Each sampling day, ethanol content (% v/v) was measured in triplicate using a Malligand ebulliometer (Ing. Bullio Castore, Milan, Italy). Total acidity (g/100 ml) was also measured in triplicate utilizing a potentiometric titrator (TitraLab AT1000, Hach-Crison, Barcelona, Spain). Additionally, at the time of aliquot collection, the temperature of the musts was recorded with a food thermometer (Tecna2, Tecnafood, Bomporto, Italy) to track the trend and identify potential fermentation anomalies.

Regarding spectroscopic analysis, after some preliminary tests, an appropriate sample treatment and signal acquisition procedure was developed. The aliquots of frozen must intended for analysis were transferred from the freezer to the refrigerator the evening before the analysis day to ensure complete thawing of the sample without restarting fermentation. Thirty minutes prior to analysis, the samples were extracted from the refrigerator and filtered through a 25-µm cellulose filter to eliminate suspended particles.

Fourier-transform near-infrared (FT-NIR) spectra were acquired in transmission mode using a Bruker Multi Purpose Analyzer (MPA) spectrophotometer equipped with a TE-InGaAs sensor, that is thermoelectrically cooled to ensure a high signal-to-noise ratio (Beć et al. 2022). Measurements were performed using a quartz Suprasil cuvette with an optical path length of 0.5 mm. A background spectrum was acquired on the empty cuvette before the analysis of each aliquot. To evaluate measurement repeatability and enhance the robustness of calibration models, three spectra were acquired for each sample, corresponding to three distinct sample aliquots. Each spectrum, derived from the average of 128 scans, was collected throughout the entire spectral range (12,500–4000 cm−1) excluding the low-wavenumber region between 4000 and 3600 cm−1 where the signal was too noisy. Considering a spectral resolution of 4 cm−1, each spectrum was composed of a total of 4407 variables. Given that it is well-known from the literature that temperature variation causes changes in both the position and intensity of bands in the NIR spectrum, especially for aqueous and alcoholic samples (Cozzolino et al. 2007; Wulfert et al. 1998), the cuvette compartment was maintained at a constant temperature of 28 °C during measurements. This was implemented to mitigate any potential variability associated with differences in the laboratory’s ambient temperature throughout the entire period during which NIR analyses were conducted.

Data Analysis

The spectral dataset, including 267 spectra, i.e., (49 samples from batch A + 40 samples from batch B) × 3 replicates, was first subjected to exploratory data analysis using Principal Component Analysis (PCA). This analysis aimed to evaluate the reproducibility of measurements, potential variations between samples from different batches, identification of outliers, and exploration of trends related to ethanol content and total acidity. Based on some preliminary tests, spectra were preprocessed using Standard Normal Variate (SNV) and mean centering.

Subsequently, Partial Least Squares (PLS) was employed as a multivariate calibration method to determine the values of ethanol and acidity from NIR spectra. The calibration models were initially derived from full NIR spectra, encompassing a spectral range spanning the entire acquired region (12,500–4000 cm−1). Analogous PLS models were also developed for two additional spectral datasets, obtained by trimming the signals to keep only specific spectral ranges. In detail, the dataset abbreviated as NIR1 encompasses the spectral range from 10,526 to 6060 cm−1 (equivalent to 950–1650 nm), while the dataset referred to as NIR2 covers the range from 12,500 to 9346 cm−1 (corresponding to 800–1070 nm).

To calculate all the PLS models, the spectral datasets were randomly divided into a calibration set (training set) containing 180 spectra (60 samples × 3 replicates) and an external validation set (test set) containing the remaining 87 spectra (29 samples × 3 replicates). Based on some preliminary trials conducted on the training set, the optimal spectral preprocessing for predicting the parameters of interest resulted from a combination of smoothing (first-order, 15 points window), SNV, and mean centering. The optimal number of latent variables (LVs) was chosen by minimizing the cross-validation error that was estimated using a venetian blinds procedure with 10 deletion groups, each including 18 spectra (corresponding to the 3 replicates of 6 samples). Subsequently, the models were validated using the external test set.

The performance of the calibration models was evaluated using Root Mean Square Error (RMSE) and coefficient of determination (R2) metrics. These metrics were calculated on the training set for calibration (RMSEC, R2Cal) and cross-validation (RMSECV, R2CV) and then on the test set for validation (RMSEP, R2Pred).

The PLS models were calculated using the PLS Toolbox (version 8.8.1, Eigenvector Research Inc., USA) operating in the MATLAB environment (version 2022b, The Mathworks Inc., USA).

Results and Discussion

Exploratory Analysis of Laboratory Parameters

The laboratory-measured physicochemical parameters (ethanol content, total acidity, and temperature) were plotted to evaluate their trends over time for the two batches. Figure 1a illustrates the variation in ethanol content and total acidity with respect to fermentation time, where each reported value is the average of three replicate measurements. From the graph, it can be observed that the ethanol content and total acidity values followed a similar pattern in both batches, but each batch progressed at a different rate. Initially, a rapid increase in ethanol content was observed, reaching its peak around day 10 for batch B and around day 25 for batch A. Around day 40, total acidity started to increase, while alcohol content declined rapidly. For batch B, ethanol was depleted after 80 days, leading to the end of fermentation. In the case of batch A, the formation of acetic acid continued more gradually, and at the time of sampling interruption, ethanol was not yet fully depleted.

Fig. 1
figure 1

Variation in ethanol content and total acidity (a) and temperature (b) on different sampling days during the fermentation period

For thoroughness, the graph illustrating the temperature changes over time is included as well (Fig. 1b). Temperature demonstrated a more stable pattern for batch A, whereas it exhibited two distinct peaks for batch B. Specifically, for batch B, temperature reached around 30 °C at the peak of alcoholic fermentation, then decreased and slightly increased again at the onset of acetic oxidation.

Exploratory Analysis of FT-NIR Spectra

Figure 2 reports the score plots of the first two principal components (PCs) of the PCA model calculated on the whole dataset of FT-NIR spectra, accounting for 91.20% of total data variance. In Fig. 2a, where the samples are color-coded by batch, it is observed that the spectra belonging to the two batches are distinguishable in the PC space, although the fermentation evolution essentially follows the same trend for both musts. This analogy becomes more evident when the samples are colored based on the sampling day, as reported in Fig. 2b. Up to approximately day 40, the values of PC1 remain approximately constant, while the values of PC2 decrease. Then, the values of PC1 gradually increase, while the values of PC2 show a less pronounced rise.

Fig. 2
figure 2

Score plots of PC1 vs PC2 of the PCA model obtained on the complete FT-NIR spectral dataset. Samples are colored based on batch (a), on fermentation day (b), on ethanol content (c), and on total acidity (d)

In Fig. 2c, d, the same score plot is depicted based on ethanol content and total acidity values, respectively. Figure 2c shows that, during alcoholic fermentation, the PC2 values gradually decrease while the PC1 values remain relatively constant. Subsequently, as acetic oxidation begins, the PC1 value progressively rises (Fig. 2d) in tandem with the gradual consumption of ethanol (Fig. 2c). Therefore, samples with high acidity exhibit high PC1 values, while samples with high ethanol content have low values for both PC1 and PC2.

Through the loading plots, it is possible to analyze the contribution of each spectral variable to the two PCs of the model and identify correlations. In Fig. 3a, the original spectra are colored based on the fermentation day, along with indications of the attributions of the main spectral bands according to the literature (Nespeca et al. 2017; Dong et al. 2019; Cozzolino et al. 2006; Di Egidio et al. 2010; Kasemsumran et al. 2022; Ye et al. 2014). In Fig. 3b, the loading plots of PC1 and PC2 are reported, in comparison with the preprocessed spectra, colored based on both ethanol content (Fig. 3c) and total acidity (Fig. 3d). Firstly, it can be observed that from the raw spectra (Fig. 3a), it is not possible to clearly discern any trend with fermentation time, as the signals are highly overlapped and exhibit a very similar profile. However, the subsequent application of preprocessing highlights the differences (Fig. 3c, d).

Fig. 3
figure 3

Original spectra colored according to the fermentation day with assignment of the main spectral bands (a) compared to the loadings plots of PC1 and PC2 (b) and with preprocessed spectra colored based on ethanol content (c) and total acidity (d)

According to existing literature, it is well-established that the absorption pattern in the NIR region during the fermentation of grape must is predominantly influenced by the water spectrum (Jiménez-Márquez et al. 2016). The presence of water gives rise to intense and broad bands attributed to the O–H bend stretching and the combination of O–H stretching and bending, as illustrated in Fig. 3a. However, it is worth noting that ethanol and acetic acid absorb at approximately the same wavelengths, as these molecules partially share similar chemical bonds and functional groups, just like fructose, glucose, and glycerol always present in grape musts. Therefore, any differences in the spectra of samples at different fermentation stages can be attributed to subtle variations in the relative intensity of peaks and/or to the horizontal shift of these peaks due to their chemical surroundings.

Nonetheless, it is interesting to observe how the two adjacent peaks at around 4400–4300 cm−1 increase with the rise in alcohol percentage, while the loadings of PC2 decrease in this region, aligning with the patterns seen in the score plot of Fig. 2c. These peaks are distinctive of ethanol, attributed to the combination band of C-H in the -CH2 and -CH3 groups (Dong et al. 2019; Cozzolino et al. 2006; Di Egidio et al. 2010). Conversely, the spectral variables that appear more correlated with acetic acid content (Fig. 3d) are those associated with the peak at approximately 5170 cm−1, linked to the combination of O–H stretching and bending vibrations. In addition to increasing in intensity (like the loadings of PC1), it undergoes a slight shift towards higher wavenumbers (Cozzolino et al. 2006; Di Egidio et al. 2010).

Calibration

As detailed in the “Data Analysis” section, calibration models were developed for three distinct datasets: the complete NIR spectra dataset (12,500–4000 cm−1), the dataset labeled as NIR1 (10,526–6060 cm−1), and the dataset labeled as NIR2, which includes only the spectral region adjacent to the visible range (12,500–9346 cm−1). In each case, the same sample partitioning into training set, test set, and deletion groups for cross-validation was used, along with identical signal preprocessing. This ensured complete comparability of the models.

Table 2 provides a comparison of the performance of all the obtained calibration models. It is worth noting that excellent models were achieved for both parameters when considering both the complete spectrum and the NIR1 region, with R2Pred values exceeding 0.98 in each case. However, performance in the NIR2 region is notably less satisfactory, albeit still of acceptable quality for screening analysis aimed at providing indicative results on ethanol and acidity content in grape musts.

Table 2 Performance of PLS models obtained for ethanol content and total acidity considering the three spectral ranges

Figure 4 reports the laboratory-measured parameter values against the values predicted by the FT-NIR models for the three spectral regions and the two investigated properties. Consistently with the model performance parameters outlined in Table 2, the measured values closely align with the predicted values for both the complete spectrum and the NIR1 region (Fig. 4a–d). On the contrary, in the graphs regarding the NIR2 region (Fig. 4e, f), a higher dispersion of samples around the fitted line (represented in red) is observed; furthermore, the bisector (represented in green) and the fitted line do not overlap, in contrast to the earlier models. Specifically, for batch B samples, both models predict ethanol content and total acidity values higher than the actual values at low levels of these parameters; for batch A, the total acidity model predicts lower values than the actual ones at low total acidity levels.

Fig. 4
figure 4

Y measured vs. Y predicted plots of PLS models obtained on the complete spectra for ethanol content (a) and total acidity (b), on the NIR1 region for ethanol content (c) and total acidity (d), and for the NIR2 region for ethanol content (e) and total acidity (f)

Finally, in Fig. 5, the Variable Importance in Projections (VIP) scores of the models are presented. The spectral variables positioned above the threshold value set equal to 1 (red dashed line) in the VIP plots are the most valuable for modeling ethanol content and acidity (Gosselin et al. 2010). It is evident that, for the complete spectrum, the VIP scores of the ethanol content model (Fig. 5a) differ from those of the acidity model (Fig. 5b), especially in the region of the two adjacent peaks at around 4400–4300 cm−1. As mentioned earlier, these peaks are characteristic of ethanol (C-H combination bands in the -CH2 and -CH3 groups). Crucial for constructing both models are the spectral variables associated with the combination of O–H stretching and bending vibrations (around 5170 cm−1) and the stretching of the O–H bond (around 7000–6800 cm−1).

Fig. 5
figure 5

VIP score plots of PLS models obtained on the complete spectra for ethanol content (a) and total acidity (b), on the NIR1 region for ethanol content (c) and total acidity (d), and for the NIR2 region for ethanol content (e) and total acidity (f)

For the models calculated considering the NIR1 region (Fig. 5c, d), there is a slight alteration in the VIP scores graphs, given that these models cannot benefit from the information of bands below 6000 cm−1. Consequently, the significant variables primarily involve the stretching of the O–H bond, a functional group found in both ethanol and acetic acid, as well as in the predominant aqueous matrix. Comparing the VIP scores with the shape of the original signals in Fig. 3a, it emerges that, during fermentation, this peak decreases in intensity and gradually shifts towards higher wavenumbers.

For the models in the NIR2 region, the presence of noise due to the low signal-to-noise ratio in this spectral region is immediately noticeable. However, the application of smoothing preprocessing has partially mitigated this issue. Additionally, from the VIP plots, it is observed how some spectral variables, not considered fundamental in the previous models, have now become significant. Specifically, the graphs suggest that the peak where the most pertinent information for the models is concentrated lies at approximately 10,300 cm−1, corresponding to the second overtone of the O–H stretching vibration (Jiménez-Márquez et al. 2016).

Conclusions

The aim of this study was to test the effectiveness of NIR spectroscopy to monitor the surface fermentation process of red grape must, comparing the results that could be obtained with devices operating in different NIR spectral regions. To this aim, we conducted a simultaneous analysis of two different batches of red grape must undergoing fermentation over an extended period up to about 4 months. During this time, the musts were subjected to both alcoholic and acetic fermentation stages.

In particular, our goal was to simulate the use of devices operating in different spectral regions to assess the potential of various commercial instruments. Specifically, models were generated over the entire range from 12,500 to 4000 cm−1, corresponding to expensive bench-top instruments, in the 10,526–6060 cm−1 range, corresponding to high-end portable instruments, and in the 12,500–9346 cm−1 range, corresponding to economical handheld instruments.

Overall, the results were excellent for models obtained considering the entire spectrum and the 10,526–6060 cm−1 region. Results obtained for the 12,500–9346 cm−1 region were less satisfactory but still acceptable for fast screening. This indicates that FT-NIR spectroscopy, even in its simpler and more economical versions, remains an optimal choice for product monitoring in the field of vinegar production, as it combines speed and efficiency with the non-invasiveness of the analysis, preserving the integrity of the sample.